Skip to content

Commit

Permalink
Merge pull request #14119 from cpanato/delete-branches
Browse files Browse the repository at this point in the history
add job to delete old branches
  • Loading branch information
rawlingsj committed Mar 5, 2024
2 parents 6ee50e8 + a26e874 commit 1477d33
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/chainguard/delete-branches.sts.yaml
@@ -0,0 +1,7 @@
issuer: https://token.actions.githubusercontent.com
subject: repo:wolfi-dev/os:ref:refs/heads/main
claim_pattern:
job_workflow_ref: wolfi-dev/os/.github/workflows/delete-old-branches.yaml@refs/heads/main

permissions:
contents: write
30 changes: 30 additions & 0 deletions .github/workflows/delete-old-branches.yaml
@@ -0,0 +1,30 @@
name: Delete old branches

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
cleanup_old_branches:
runs-on: ubuntu-latest

if: github.repository == 'wolfi-dev/os'

permissions:
id-token: write # To gitsign and federate

steps:
- uses: chainguard-dev/octo-sts-action@6177b4481c00308b3839969c3eca88c96a91775f # v1.0.0
id: octo-sts
with:
scope: ${{ github.repository }}
identity: delete-branches

- uses: wolfi-dev/actions/install-wolfictl@main

- name: Delete Branches
run: |
wolfictl gh gc branch https://github.com/wolfi-dev/os --match "wolfictl-"
env:
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}

0 comments on commit 1477d33

Please sign in to comment.