Use this Github Action to clean up resources after X minutes by calling a URL (GET/POST)
- 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.
Add to your Yaml file:
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).
- 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).
- Marketplace link: marketplace/actions/clean-up-resources
- Article: Github Action - Clean up resources
- Usage example: parcelui