Files
i-tools/.github/workflows/clean-up.yml
yfan 3d175d75af
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Sync to CNB / sync (push) Has been cancelled
Delete old workflow runs / del_runs (push) Has been cancelled
Upstream Sync / Sync latest commits from upstream repo (push) Has been cancelled
first commit
2026-01-30 16:57:44 +08:00

51 lines
1.5 KiB
YAML

name: Delete old workflow runs
on:
schedule:
- cron: '0 0 * * *'
jobs:
del_runs:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
permissions:
actions: write
contents: read
id-token: write
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 30
keep_minimum_runs: 6
# Points to a recent commit instead of `main` to avoid supply chain attacks. (The latest tag is very old.)
- name: 🎟 Get GitHub App token
uses: actions/create-github-app-token@v1
id: get-token
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Delete workflow runs for current repo
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 7
keep_minimum_runs: 6
- name: Delete deployment
uses: strumwolf/delete-deployment-environment@v2.3.0
with:
token: ${{ steps.get-token.outputs.token }}
environment: Preview
onlyRemoveDeployments: true
- name: Delete MAIN deployment
uses: strumwolf/delete-deployment-environment@v2.3.0
with:
token: ${{ steps.get-token.outputs.token }}
environment: Production
onlyRemoveDeployments: true