ngduc / clean-up-action

Github Action to clean up resources.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

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

About

Github Action to clean up resources.

License:MIT License


Languages

Language:JavaScript 100.0%