Skip to content

Delete older releases and workflows #154

Delete older releases and workflows

Delete older releases and workflows #154

#==========================================================================
# https://github.com/ophub/amlogic-s9xxx-openwrt
# Description: Delete older releases and workflows runs
#==========================================================================
name: Delete older releases and workflows
on:
repository_dispatch:
workflow_dispatch:
inputs:
delete_releases:
description: "Delete Releases file?"
required: true
default: true
type: boolean
delete_tags:
description: "Delete related Tags?"
required: false
default: true
type: boolean
prerelease_option:
description: "Whether to differentiate pre-release."
required: false
default: "all"
type: choice
options:
- all
- true
- false
releases_keep_latest:
description: "How many latest releases to keep."
required: false
default: "2"
type: choice
options:
- 30
- 20
- 10
- 9
- 8
- 7
- 6
- 5
- 4
- 3
- 2
- 1
- 0
releases_keep_keyword:
description: "Keyword of the keep releases."
required: false
default: "v0/_save_/kernel_"
delete_workflows:
description: "Delete workflows records?"
required: true
default: true
type: boolean
workflows_keep_day:
description: "Days to keep workflows."
required: false
default: "1"
type: choice
options:
- 30
- 20
- 10
- 9
- 8
- 7
- 6
- 5
- 4
- 3
- 2
- 1
- 0
workflows_keep_keyword:
description: "keywords for keep workflows."
required: false
default: ""
out_log:
description: "Output detailed JSON logs."
required: false
default: true
type: boolean
env:
TZ: America/New_York
jobs:
build:
runs-on: ubuntu-22.04
if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialization environment
id: init
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo timedatectl set-timezone "${TZ}"
echo "status=success" >> ${GITHUB_OUTPUT}
- name: Delete releases and workflows runs
uses: ophub/delete-releases-workflows@main
with:
delete_releases: ${{ inputs.delete_releases }}
delete_tags: ${{ inputs.delete_tags }}
prerelease_option: ${{ inputs.prerelease_option }}
releases_keep_latest: ${{ inputs.releases_keep_latest }}
releases_keep_keyword: ${{ inputs.releases_keep_keyword }}
delete_workflows: ${{ inputs.delete_workflows }}
workflows_keep_day: ${{ inputs.workflows_keep_day }}
workflows_keep_keyword: ${{ inputs.workflows_keep_keyword }}
out_log: ${{ inputs.out_log }}
gh_token: ${{ secrets.GITHUB_TOKEN }}