An open API service indexing awesome lists of open source software.

https://github.com/ngduc/clean-up-action

Github Action to clean up resources.
https://github.com/ngduc/clean-up-action

Last synced: 9 months ago
JSON representation

Github Action to clean up resources.

Awesome Lists containing this project

README

          


javscript-action status

# Clean-up-action

Use this Github Action to clean up resources after X minutes by calling a URL (GET/POST)

### Use cases
- After deploying to a demo environment, 1 day later, we want it to clean up itself by triggering an API endpoint to remove that demo environment.
- After running some steps, we want to trigger an endpoint to notify somebody, etc.

### Usage

Add to your Yaml file:

```yml
jobs:
clean:
runs-on: ubuntu-latest
steps:
- name: cleanup
uses: ngduc/clean-up-action@master
with:
projectId: setYourProjectId # set your unique projectId, example: myProjectId1
expiryMins: 1440 # after X minutes, invoke the below URL endpoint.
method: 'POST' # one of these methods: GET, POST, PUT, PATCH, DELETE
url: https://some.cleanup.api.endpoint # some URL endpoint to clean up resources.
headers: '' # headers (JSON string).
payload: '{ "someResourceId": 1234 }' # payload for url (JSON string).
```

### How It Works

- The cleanup action is scheduled to run in X minutes.
- There is a cronjob to check it continously. After X minutes, it will trigger your URL endpoint with parameters to clean up resources (or do something else).

### Links

- Marketplace link: [marketplace/actions/clean-up-resources](https://github.com/marketplace/actions/clean-up-resources)
- Article: [Github Action - Clean up resources](https://dev.to/ngduc/github-action-clean-up-resources-i70)
- Usage example: [parcelui](https://github.com/ngduc/parcelui/blob/master/.github/workflows/ci.yml#L39-L47)