Skip to content

Commit 264b125

Browse files
committed
workflows: chown workspace before checkout in all repo-runner jobs
The self-hosted 'repository' runner pool is shared across workflows (and across runs of the same workflow). Several jobs already pre-chown $GITHUB_WORKSPACE back to the runner user before actions/checkout@v6 fires — update-repository, Sync, Index — precisely because prior sudo operations on tools/repository/repo.sh output can leave root-owned files in the workspace. Checkout's default clean: true then fails with EACCES unlink when it hits one: Error: File was unable to be removed Error: EACCES: permission denied, unlink '/home/actions-runner-23/_work/armbian.github.io/armbian.github.io/build/.coderabbit.yaml' Copying and prepare-repos in the caller workflow, and postclean in the reusable download-external workflow, were the three remaining repo-runner jobs missing this guard. Add the same 'Fix workspace ownership' step to each. Makes workspace state robust to whatever the previous job left behind, without having to reason about which specific sudo op produced the root-owned file.
1 parent 8bb544b commit 264b125

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/infrastructure-download-external.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,18 @@ jobs:
152152
runs-on: repository
153153
steps:
154154

155+
# Pre-chown before checkout. The Purge step below runs sudo
156+
# against /publishing/repository-debs and against the runner's
157+
# workspace-relative tools/repository/repo.sh output — both can
158+
# leave root-owned files under $GITHUB_WORKSPACE, so a later
159+
# non-root actions/checkout@v6 with clean: true (in the caller
160+
# workflow's Copying job) fails with EACCES. Reclaim ownership
161+
# first so the workspace is always deletable by the runner user.
162+
- name: Fix workspace ownership
163+
if: always()
164+
run: |
165+
sudo chown -R "$(id -u)":"$(id -g)" "$GITHUB_WORKSPACE" || true
166+
155167
- name: Checkout build repository
156168
uses: actions/checkout@v6
157169
with:

.github/workflows/infrastructure-repository-update.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ jobs:
7878
runs-on: repository
7979
steps:
8080

81+
# Reclaim workspace before the later actions/checkout@v6 runs
82+
# with clean: true. The self-hosted `repository` runner pool is
83+
# shared across workflows, and any previous run that left
84+
# root-owned files under $GITHUB_WORKSPACE (e.g. the reusable
85+
# download-external workflow's postclean, which runs sudo
86+
# operations on the repo tree) would trip checkout's unlink
87+
# with EACCES on files like build/.coderabbit.yaml. Same
88+
# defensive chown the update-repository / Sync / Index jobs
89+
# already do as their first step.
90+
- name: Fix workspace ownership
91+
if: always()
92+
run: |
93+
sudo chown -R "$(id -u)":"$(id -g)" "$GITHUB_WORKSPACE" || true
94+
8195
- name: Delete empty folders in INCOMING_PATH
8296
run: |
8397
@@ -193,6 +207,12 @@ jobs:
193207
needs: Copying
194208
runs-on: repository
195209
steps:
210+
# See Copying's identical step for rationale.
211+
- name: Fix workspace ownership
212+
if: always()
213+
run: |
214+
sudo chown -R "$(id -u)":"$(id -g)" "$GITHUB_WORKSPACE" || true
215+
196216
- name: Checkout build repository
197217
uses: actions/checkout@v6
198218
with:

0 commit comments

Comments
 (0)