Skip to content

Commit eff2980

Browse files
committed
Share Linux build deps via artifact, not cache
The Auto-Release workflow fires on pull_request: closed and its head ref is the (now-deleted) PR source branch — auto-merge.yml uses `gh pr merge --delete-branch`. GitHub Actions scopes cache writes to the workflow's head ref; with the ref already deleted by the time Auto-Release starts, the runtime token has no writable scopes and the save fails with: Cache reservation failed: cache write denied: token has no writable scopes Failed to save: Unable to reserve cache with key <run_id>-dependencies The downstream build_linux jobs then hit "Cache not found" during restore, tree $RELENV_DATA/download errors out, and every Linux entry fails. That's what killed the 0.22.17 release run (28422611083). The same run on pr.yml's push-to-main path (28422611021) worked because main is a real ref with a valid cache scope. Artifacts are scoped to the run_id, not a branch ref, so branch deletion doesn't affect them. Swap the actions/cache pair for actions/upload-artifact + actions/download-artifact: - retention-days: 1 keeps the artifact tiny in storage - if-no-files-found: error catches the case where --download-only silently produced nothing Behaviour is identical for the pr.yml path (both cache and artifact work there); the Auto-Release path stops failing.
1 parent 5afea51 commit eff2980

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

.github/workflows/build-native-action.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,21 @@ jobs:
2727
- name: Download Dependencies
2828
run: |
2929
python3 -m relenv build --download-only
30-
- name: Cache Dependencies
31-
uses: actions/cache@v4
30+
# Use an artifact instead of actions/cache: cache writes are scoped
31+
# to the workflow's head ref, and Auto-Release fires on
32+
# `pull_request: closed` where the source branch has just been
33+
# deleted by auto-merge.yml's `--delete-branch`. With no valid ref
34+
# for the cache scope, the runtime token has no writable scopes
35+
# and the save fails ("token has no writable scopes"). Artifacts
36+
# are scoped to the run_id, not a branch ref, so branch deletion
37+
# doesn't affect them.
38+
- name: Upload Build Dependencies Artifact
39+
uses: actions/upload-artifact@v4
3240
with:
41+
name: python-build-download
3342
path: ${{ github.workspace }}/download
34-
key: ${{ github.run_id }}-dependencies
43+
retention-days: 1
44+
if-no-files-found: error
3545

3646
build_linux:
3747
strategy:
@@ -86,11 +96,11 @@ jobs:
8696
venv/bin/python3 --version
8797
venv/bin/python3 -c 'import os; print(os.name)'
8898
89-
- name: Restore Cached Dependencies
90-
uses: actions/cache/restore@v4
99+
- name: Download Build Dependencies Artifact
100+
uses: actions/download-artifact@v4
91101
with:
102+
name: python-build-download
92103
path: ${{ github.workspace }}/download
93-
key: ${{ github.run_id }}-dependencies
94104

95105
- name: List downloads
96106
run: |

0 commit comments

Comments
 (0)