Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
play

GitHub Action

Remove artifacts

v1.0.1

Remove artifacts

play

Remove artifacts

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Remove artifacts

uses: c-hive/[email protected]

Learn more about this action in c-hive/gha-remove-artifacts

Choose a version

gha-remove-artifacts

GitHub Action to remove old artifacts

Status and support

  • ✔ stable
  • ✔ supported
  • ✖ no ongoing development

CI

GitHub Action Artifacts are removed after 90 days. This cannot be configured either globally or per project. There's also a limit on free artifact space after which it becomes a payed resource. There's no configurable storage limit per project either, so some projects might use up all quota and not leave room for others.

We created this Action to solve these problems. It

  • removes artifacts that are older than the specified age
  • has the option to keep release (tagged) artifacts
  • respects GitHub's rate limit

Usage

Add the following workflow to your repository and configure options.

.github/workflows/remove-old-artifacts.yml

name: Remove old artifacts

on:
  schedule:
    # Every day at 1am
    - cron: '0 1 * * *'

jobs:
  remove-old-artifacts:
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
    - name: Remove old artifacts
      uses: c-hive/gha-remove-artifacts@v1
      with:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        age: '1 month'
        skip-tags: true

Conventions

This project follows C-Hive guides for code style, way of working and other development concerns.

License

The project is available as open source under the terms of the MIT License.