Skip to content

Commit

Permalink
ci: Add automatic and manual branch cache cleanup (#441)
Browse files Browse the repository at this point in the history
* Branch cache clean

* Add cache cleaning workflows

* Update package-lock.json
  • Loading branch information
ankurdotb committed Nov 8, 2022
1 parent a445fc0 commit 06d8881
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 62 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/cleanup-cache-automatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Cache Cleanup - Automatic"
on:
pull_request:
types:
- closed
defaults:
run:
shell: bash


jobs:

cache-purge:
name: "Purge Actions cache"
runs-on: ubuntu-latest

steps:

- name: "Delete Branch Cache Action"
uses: snnaplab/delete-branch-cache-action@v1.0.0
with:
# Specify explicitly because the ref at the time of merging will be a branch name such as 'main', 'develop'
ref: refs/pull/${{ github.event.number }}/merge
github-token: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Cleanup - Cache"
name: "Cache Cleanup - Manual"
on:
workflow_dispatch:
inputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
# to override config-conventional rules, specify a relative path to your rules module, actions/checkout is required for this setting!
commitlintRulesPath: "./.github/linters/.commitlint.rules.js" # default: undefined
# if the PR contains a single commit, fail if the commit message and the PR title do not match
commitTitleMatch: "false" # default: 'true'
commitTitleMatch: false # default: 'true'
14 changes: 0 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,3 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=min

cache-purge:
name: "Purge branch Actions cache"
needs: [release-binary, release-docker]
runs-on: ubuntu-latest

steps:

- name: "Delete Branch Cache Action"
uses: snnaplab/delete-branch-cache-action@v1.0.0
with:
# Specify explicitly because the ref at the time of merging will be a branch name such as 'main', 'develop'
ref: refs/pull/${{ github.event.number }}/merge
github-token: ${{ secrets.GITHUB_TOKEN }}
94 changes: 48 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 06d8881

Please sign in to comment.