Skip to content

Commit cb5e08e

Browse files
committed
chore(template): sync with dailydevops/dotnet-template [skip ci]
1 parent 5444d79 commit cb5e08e

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Delete Cache after PR merge
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
permissions:
9+
contents: read
10+
actions: write
11+
12+
jobs:
13+
cleanup:
14+
name: Clear cache
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Cleanup
24+
run: |
25+
gh extension install actions/gh-actions-cache
26+
27+
REPO=${{ github.repository }}
28+
29+
# get the branch
30+
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
31+
32+
# fetch list of cache key
33+
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
34+
35+
# set this to not fail the workflow while deleting cache keys
36+
set +e
37+
38+
# delete cache key
39+
for cacheKey in $cacheKeysForPR
40+
do
41+
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
42+
done
43+
env:
44+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish-nuget.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ on:
99
permissions:
1010
actions: read
1111
contents: write
12+
pull-requests: write
13+
14+
concurrency:
15+
group: publish-nuget
16+
cancel-in-progress: true
1217

1318
jobs:
1419
nuget:
1520
name: Publish
16-
if: ${{ github.event.workflow_run.conclusion == 'success' && github.actor != 'dependabot[bot]' }}
21+
if: ${{ github.event.workflow_run.conclusion == 'success' && github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }}
1722
uses: dailydevops/pipelines/.github/workflows/publish-nuget.yml@cb37352bc6f2f8b723d966d5d879625d3dd5413b # 1.3.13
1823
with:
1924
workflowName: ${{ github.event.workflow_run.name }}

0 commit comments

Comments
 (0)