@@ -125,19 +125,23 @@ jobs:
125125 echo "[ SUCCESS ] Upload finished"
126126
127127 - name : Commit updated sha.txt
128+ env :
129+ GH_TOKEN : ${{ github.token }}
128130 run : |
129- cd "$GITHUB_WORKSPACE"
130-
131- echo "---- debug ----"
132- echo "pwd: $(pwd)"
133- echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
134- whoami
135- ls -la .git 2>&1 | head -5
136- git rev-parse --show-toplevel 2>&1 || echo "git rev-parse failed"
137- git status 2>&1 | head -5 || echo "git status failed"
138- echo "---------------"
139-
140- git config --global --add safe.directory '*'
131+ # $GITHUB_WORKSPACE/.git is gone by this point (something in the
132+ # mkarchiso/pacstrap process wipes or obscures it) -- clone fresh
133+ # into a separate dir instead of depending on the build workspace's
134+ # own repo state.
135+ new_sha=$(cat "$GITHUB_WORKSPACE/sha.txt")
136+
137+ clonedir=$(mktemp -d)
138+ git clone --depth 1 --branch "${GITHUB_REF_NAME}" \
139+ "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" \
140+ "$clonedir"
141+
142+ cd "$clonedir"
143+ echo "$new_sha" > sha.txt
144+
141145 git config user.name "pearOS build bot"
142146 git config user.email "actions@users.noreply.github.com"
143147
@@ -147,5 +151,5 @@ jobs:
147151 fi
148152
149153 git add sha.txt
150- git commit -m "Update sha.txt for $(basename "$(ls *.iso 2>/dev/null | head -n1)")"
151- git push origin HEAD: "${GITHUB_REF_NAME}"
154+ git commit -m "Update sha.txt for $(basename "$(ls "$GITHUB_WORKSPACE"/ *.iso 2>/dev/null | head -n1)")"
155+ git push origin "${GITHUB_REF_NAME}"
0 commit comments