Skip to content

Commit

Permalink
ci: add go cache step in lint
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAnotherID committed Oct 20, 2024
1 parent 3619e98 commit 8265bab
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/cleanup-caches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Cleanup Caches from Pull Request
on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup
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: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
1 change: 0 additions & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false
- run: go get
- run: go generate ./...
- name: Set Up GolangCI-Lint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on:
paths:
- '**.go'
- 'go.mod'
- '.github/workflows/test_and_lint.yml'
- 'test-and-lint.yml'
pull_request:
paths:
- '**.go'
- 'go.mod'
- '.github/workflows/test_and_lint.yml'
- 'test-and-lint.yml'

jobs:
test-and-lint:
Expand All @@ -23,7 +23,6 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false
- run: go get
- run: go generate ./...

Expand All @@ -35,5 +34,4 @@ jobs:
if: github.event_name != 'pull_request'
with:
version: 'v1.61.0'
args: '--timeout 9999s'
skip-cache: true
args: '--timeout 9999s'

0 comments on commit 8265bab

Please sign in to comment.