Giter Club home page Giter Club logo

artifact-cleaner's Introduction

This is an action that you can run on a regular basis to clean up outdated workflow run artifacts before their typical 90 day expiry.

By default, all artifacts are deleted. There are options to only delete big artifacts, artifacts of a certain age or ones with a specific name.

Suggested usage is in a standalone workflow doc at .github/workflows/cleanup.yml with the following content:

name: clean artifacts

on:
  schedule:
    - cron: '0 0 * * *'

jobs:
  clean:
    runs-on: ubuntu-latest
    steps:
      - name: cleanup
        uses: glassechidna/artifact-cleaner@master
        with:
          minimumAge: 86400 # all artifacts at least one day old

This cleans all artifacts once a day.

artifact-cleaner's People

Contributors

aidansteele avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

artifact-cleaner's Issues

Continue on error

I just started using this Action and had a quick look at the source code to see how it works. Based on that (and not on my experience with the Action so far) I have one suggestion: instead of terminating the Action when there is an error or an unexpected error, continue when an error occurs and report all the errors that occurred when the Action finished.

I'm not a Go expert but I would suggested doing that by returning []error in forEachArtifact and appending any errors from iter (and possibly ListWorkflowRuns?) to a slice that is returned when the last page is reached.

I do think there should be a separate way to handle the error reported in #2 to ensure the Action stops as soon as the rate limit is reached.


As an aside, based on reading the code it seems that return-on-stop is never executed because iter only ever returns true if it also returns an error. This may be simplifed by returning just an error (instead of both a boolean and an error).

Failed to run

Failed to run:

panic: GET https://api.github.com/repos/<repo>/actions/runs/162904418/artifacts: 500  []

goroutine 1 [running]:
main.main()
	/cleaner/main.go:62 +0x34e

No further information in the logs.

Keep last artifact of each run

Hello,
Would it be possible to keep the last artifact of each workflow (if any). It would be handy to do proper CI/CI without overload artifact quota

GitHub's API rate limiting problem

When using scheduled cleanup job I get following error after deleting a few artifacts:

panic: DELETE https://api.github.com/repos/*repo_path*/actions/artifacts/2340371: 403 API rate limit of 1000 still exceeded until 2020-04-14 01:14:13 +0000 UTC, not making remote request. [rate reset in 56m45s]

Would it be possible to somehow fix this by deleting whole bunch of artifacts at once?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.