Skip to content

Commit af696f7

Browse files
committed
fix(gh-cache): Get remote changes before pushing, to avoid concurrent write failures
1 parent 3188221 commit af696f7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/actions/gh-cache/save/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ runs:
4545
token: ${{ inputs.token }}
4646
fetch-depth: 0
4747
path: .gh-cache-${{ github.run_id }}
48-
show-progress: 'false'
48+
show-progress: "false"
4949

5050
- name: Switch to gh-cache branch (or create orphan)
5151
shell: bash
@@ -79,6 +79,10 @@ runs:
7979
git commit -m "$(printf 'Save artifact: %s' "${{ inputs.path }}")" \
8080
&& echo "Committed '${{ inputs.path }}' to 'gh-cache' branch" \
8181
|| echo "No changes to commit"
82+
if git ls-remote --exit-code --heads origin gh-cache >/dev/null; then
83+
git fetch origin gh-cache
84+
git rebase origin/gh-cache
85+
fi
8286
git push origin gh-cache
8387
else
8488
echo "'${{ inputs.path }}' does not exist"

0 commit comments

Comments
 (0)