Skip to content

Action responsible for deleting old artifacts by setting expire duration.

License

Notifications You must be signed in to change notification settings

Spendesk/purge-artifacts-action

 
 

Repository files navigation

Delete artifacts action

Action responsible for deleting old artifacts by setting expire duration.

Hopefuly this is just temporary solution till github implements this functionality natively.

Inputs

expire-in

Required for how long the artifacts should be kept. Most of the human readable formats are supported 10 minutes, 1hr 20mins, 1week. Take a look at parse-duration for more information.

Outputs

deleted-artifacts

Serialized list of deleted artifacts. Empty [] when nothing is deleted

Usage

Run this action as cron. This won't delete artifacts of running workflows because they are persisted after workflow completion.

name: 'Delete old artifacts'
on:
  schedule:
    - cron: '0 * * * *' # every hour

jobs:
  delete-artifacts:
    runs-on: ubuntu-latest
    steps:
      - uses: kolpav/purge-artifacts-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          expire-in: 7days # Setting this to 0 will delete all artifacts

Contributing

There are few improvements to be made, namely

  • More delete strategies (name, size, number of occurences, regex match on name etc..)
  • Better test coverage

About

Action responsible for deleting old artifacts by setting expire duration.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 92.2%
  • JavaScript 7.8%