Skip to content

Commit a5ce33e

Browse files
bdehamerCopilot
andauthored
ci: download rebuilt dist/ artifact outside the checkout workspace (#445)
commit-dist.yml downloaded the artifact into `incoming/` within the workspace, but the later actions/checkout step runs `git clean -ffdx` and deleted that untracked directory before the apply step, failing with "mv: cannot stat 'incoming/dist'". Download to ${{ runner.temp }}/incoming instead, which lives outside $GITHUB_WORKSPACE and is untouched by checkout's clean. Co-authored-by: Copilot App <[email protected]>
1 parent 4c65731 commit a5ce33e

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎.github/workflows/commit-dist.yml‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ jobs:
3737
name: rebuilt-dist
3838
run-id: ${{ github.event.workflow_run.id }}
3939
github-token: ${{ github.token }}
40-
path: incoming
40+
# Download OUTSIDE the checkout workspace: the later actions/checkout
41+
# step runs `git clean -ffdx`, which would delete an untracked
42+
# `incoming/` dir inside the workspace before we can use it.
43+
path: ${{ runner.temp }}/incoming
4144

4245
# No artifact => the builder found dist/ already up to date. Nothing to do.
4346
# The head-ref/head-sha values come from an artifact produced in the
@@ -46,13 +49,14 @@ jobs:
4649
- name: Check for artifact
4750
id: check
4851
run: |
49-
if [ ! -d incoming/dist ] || [ ! -f incoming/dist-meta/head-ref ] || [ ! -f incoming/dist-meta/head-sha ]; then
52+
incoming="${{ runner.temp }}/incoming"
53+
if [ ! -d "$incoming/dist" ] || [ ! -f "$incoming/dist-meta/head-ref" ] || [ ! -f "$incoming/dist-meta/head-sha" ]; then
5054
echo "present=false" >> "$GITHUB_OUTPUT"
5155
exit 0
5256
fi
5357
54-
head_ref="$(head -n1 incoming/dist-meta/head-ref | tr -d '\r\n')"
55-
head_sha="$(head -n1 incoming/dist-meta/head-sha | tr -d '\r\n')"
58+
head_ref="$(head -n1 "$incoming/dist-meta/head-ref" | tr -d '\r\n')"
59+
head_sha="$(head -n1 "$incoming/dist-meta/head-sha" | tr -d '\r\n')"
5660
5761
if ! printf '%s' "$head_sha" | grep -Eq '^[0-9a-f]{40}$'; then
5862
echo "Invalid head-sha; refusing to proceed." >&2
@@ -89,8 +93,8 @@ jobs:
8993
if: steps.check.outputs.present == 'true'
9094
run: |
9195
rm -rf dist
92-
mv incoming/dist dist
93-
rm -rf incoming
96+
mv "${{ runner.temp }}/incoming/dist" dist
97+
rm -rf "${{ runner.temp }}/incoming"
9498
9599
- name: Commit and push
96100
if: steps.check.outputs.present == 'true'

0 commit comments

Comments
 (0)