Skip to content

Commit

Permalink
Use cache only on main and release branches (#12754)
Browse files Browse the repository at this point in the history
Using cache by default for each run is useless waste of cache.

Some runs for some branches executed only once, but their caches replace
action cache which instead could be used by frequently running jobs on
main/release branches.
  • Loading branch information
lystopad authored Nov 18, 2024
1 parent 1e21242 commit 174beab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: ${{ contains(fromJSON('[
"refs/heads/release/2.60",
"refs/heads/release/2.61",
"refs/heads/main"
]'), github.ref) }}

- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
Expand Down Expand Up @@ -84,6 +91,11 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: ${{ contains(fromJSON('[
"refs/heads/release/2.60",
"refs/heads/release/2.61",
"refs/heads/main"
]'), github.ref) }}

- uses: actions/cache@v4
with:
Expand Down

0 comments on commit 174beab

Please sign in to comment.