Skip to content

Commit

Permalink
CI: try cleanup of build cache, cancelled runs when Pull Request is c…
Browse files Browse the repository at this point in the history
…losed (#318)

* ci: create cleanup.yml
* ci: support `workflow_dispatch` of Cleanup workflow
* ci: setup gh auth with GH_TOKEN
  • Loading branch information
luncliff authored Feb 11, 2025
1 parent 5806217 commit b90db5a
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Cleanup"

on:
pull_request:
types: [closed]
workflow_dispatch:
inputs:
branch:
description: 'Name of the Git branch'
required: true
default: 'main'

jobs:
clean-cache:
name: "Cleanup Cache"
runs-on: windows-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v4.2.2
- name: "Run gh(auth)"
run: gh auth status
- name: "Run gh-cleanup-cache.ps1"
run: |
$branch = "${{ github.event.pull_request.head.ref || github.event.inputs.branch }}"
./scripts/gh-cleanup-cache.ps1 -Branch "$branch"
shell: pwsh

clean-runs:
name: "Cleanup Runs"
runs-on: windows-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v4.2.2
- name: "Run gh(auth)"
run: gh auth status
- name: "Run gh-cleanup-runs.ps1"
run: |
$branch = "${{ github.event.pull_request.head.ref || github.event.inputs.branch }}"
./scripts/gh-cleanup-runs.ps1 -Branch "$branch" `
-Workflow "build.yml" `
shell: pwsh
- name: "Run gh-cleanup-runs.ps1"
run: |
$branch = "${{ github.event.pull_request.head.ref || github.event.inputs.branch }}"
./scripts/gh-cleanup-runs.ps1 -Branch "$branch" `
-Workflow "build-windows-hosted.yml" `
shell: pwsh

0 comments on commit b90db5a

Please sign in to comment.