GithubHelp home page GithubHelp logo

mwigginsdev_delete-oldest-workflow-runs's Introduction

delete-oldest-workflow-runs

The GitHub action to deletes all runs before the specified number to keep (keep_minimum_runs) for a specific workflow. This action (written in JavaScript) wraps two Workflow Runs API:

Inputs

1. token

Required: YES

Default: ${{ github.token }}

The token used to authenticate.

  • If the workflow runs are in the current repository where the action is running, using github.token is OK. More details, see the GITHUB_TOKEN.
  • If the workflow runs are in another repository, you need to use a personal access token (PAT) that must have the repo scope. More details, see "Creating a personal access token".

2. repository

Required: YES

Default: ${{ github.repository }}

The name of the repository where the workflow runs are on

3. keep_minimum_runs

Required: YES

Default: 6

The minimum runs to keep for each workflow.

4. workflow_name

Required: YES

Default: ""

The minimum runs to keep for each workflow.

In manual triggered workflow, see workflow_dispatch event.

In this way, you can manually trigger the workflow at any time to delete old workflow runs.

name: Delete old runs for specific work flow
on:
  workflow_dispatch:
    inputs:
      minimumRunsToKeep:
        description: 'Number of workflow runs to keep'
        required: true
        default: 10
      workflowName:
        description: 'Name of workflow to delete from'
        required: true
        default: 'Builds'

jobs:
  del_runs:
    runs-on: ubuntu-latest
    steps:
      - name: Delete workflow runs
        uses: mwigginsdev/delete-oldest-workflow-runs@main
        with:
          token: ${{ secrets.AUTH_PAT }}
          repository: ${{ github.repository }}
          keep_minimum_runs: ${{ github.event.inputs.minimumRunsToKeep }}
          workflow_name: ${{ github.event.inputs.workflowName }}

License

The scripts and documentation in this project are released under the MIT License.

mwigginsdev_delete-oldest-workflow-runs's People

Contributors

brightran avatar mattraks avatar mwigginsdev avatar tspascoal avatar

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.