https://github.com/major0/gh-artifact-cleanup
GitHub Action to cleanup orphaned/stale build artifacts.
https://github.com/major0/gh-artifact-cleanup
artifact artifact-management github-actions
Last synced: 7 months ago
JSON representation
GitHub Action to cleanup orphaned/stale build artifacts.
- Host: GitHub
- URL: https://github.com/major0/gh-artifact-cleanup
- Owner: major0
- Created: 2022-04-06T00:38:49.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-11T14:35:32.000Z (over 3 years ago)
- Last Synced: 2024-10-14T09:13:47.335Z (about 1 year ago)
- Topics: artifact, artifact-management, github-actions
- Language: Shell
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
GitHub Artifact Cleanup Action
==============================This actions cleans up orphaned artifacts created by [GitHub Actions][].
Orphaned artifacts are artifacts which belong to a [Git][] ref which is
no-longer the tip of any branch. Generally this is a result of a developer
making updates to a [pull-request][], though it also includes artifacts for any
pull-requests which have been accepted into the mainline of development. This
action assumes that any report/log artifacts for a rebased [pull-request][]
can be discarded, and any artifacts for a merged [pull-request][] will be
replaced by new workflow runs when the mainline (master/main/trunc/etc) is
updated.Basic Usage
-----------By default the action will inspect all action runs in a repository and delete
all artifacts which are from a git ref which is no longer the head/tip of a
branch. This behavior can be modified via the `newer` and `older` input
parameters.```yaml
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: major0/gh-artifact-cleanup@v1
token: ${{ secrets.TOKEN }}
newer: 30 # optional
older: 7 # optional
debug: false # defaults to false
dry-run: true # defaults to false
```See the the [cleanup workflow](.github/workflows/cleanup.yaml) for a complete
example.Input Parameters
----------------| Input | Description | Required | Default |
|:----------|:------------------------------------------------------------------------------|:--------:|:--------------:|
| `token` | Authentication token to use when cleaning repository. | `true` | |
| `older` | Limit work to artifacts that are older than the specified number of days old. | `false` | |
| `newer` | Limit to artifacts that are newer than the specified number of days. | `false` | |
| `dry-run` | Do not make any repository changes, only report what would be done. | `false` | `false` |
| `debug` | Enable script execution tracing. | `false` | `false` |[//]: # (references)
[GitHub Actions]: https://docs.github.com/en/actions
[Git]: https://git-scm.com
[pull-request]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests