An action that deletes an artifact associated with given workflow.
Report Bug
·
Request Feature
Let's suppose you have a workflow with a job in it that at the end uploads an artifact using actions/upload-artifact
action and you want to download this artifact in another workflow using dawidd6/action-download-artifact. After downloading the artifact and doing something with the artifact (like deploying something to GitHub Pages), you may want to clean up the workflow artifact to stay within storage cost restrictions. This GitHub Actions helps with that.
cleanup-artifacts:
name: Job to clean up old artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Remove artifact
uses: philips-labs/action-delete-artifacts@v1.0.0
with:
# Optional, GitHub token, a Personal Access Token with `repo` scope if needed
# Required, if artifact is from a different repo
# Required, if repo is private a Personal Access Token with `repo` scope is needed
github_token: ${{secrets.GITHUB_TOKEN}}
# Required, workflow file name or ID
workflow: workflow-name.yml
# Optional, uploaded artifact name,
# will delete all artifacts if not specified
name: artifact.json
# Optional, the status or conclusion of a completed workflow to search for
# Can be one of a workflow conclusion:
# "failure", "success", "neutral", "cancelled", "skipped", "timed_out", "action_required"
# Default is set to success
workflow_conclusion: success
name: Deploy Portal
on:
workflow_run:
branches:
- main
workflows: ["Deployment"]
types:
- completed
workflow_dispatch:
jobs:
cleanup-artifacts:
name: Job to clean up old artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download artifact
uses: philips-labs/action-delete-artifacts@v1.0.0
with:
workflow: crawl.yml
name: repos.json
If you have a suggestion that would make this project better, please fork the repository and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
This project is inspired by: