Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAE-18301 new action to clean GH cache after pr merge #381

Merged
merged 6 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/actions/gh-cache-cleanup-on-merge/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "GH cache cleanup"
description: "Performs the cleanup of cache entries related with already closed PR"
atchertchian marked this conversation as resolved.
Show resolved Hide resolved
inputs:
token:
description: The GH token
required: true
runs:
using: composite
steps:
- name: Cache cleanup
shell: bash
run: |
gh extension install actions/gh-actions-cache

echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )

## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ inputs.token }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ updates:
directory: "/.github/actions/get-commit-message"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/.github/actions/gh-cache-cleanup-on-merge"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/.github/actions/git-check-existing-tag"
schedule:
Expand Down
10 changes: 10 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,16 @@ Runs Veracode Source Clear Scan
srcclr-install-options: '-DskipTestModules' # optional, additional maven options
```

### github cache cleanup

Performs the cleanup of cache entries related with already closed PR

```yaml
- uses: Alfresco/alfresco-build-tools/.github/actions/gh-cache-cleanup-on-merge@ref
wojciech-piotrowiak marked this conversation as resolved.
Show resolved Hide resolved
with:
token: ${{ secrets.GH_TOKEN }}
```

## Reusable workflows provided by us

### helm-publish-new-package-version.yml
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.8.1
v3.9.1
Loading