Skip to content

Commit 6d230de

Browse files
committed
Attempt to fix matrix gh-cache push
1 parent 4618a36 commit 6d230de

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,17 @@ runs:
9494
git config user.email "github-actions[bot]@users.noreply.github.com"
9595
git commit -m "$(printf 'Save artifact: %s' "${{ inputs.path }}")" \
9696
&& echo "Committed '${{ inputs.path }}' to 'gh-cache' branch" \
97-
|| echo "No changes to commit"
98-
if git ls-remote --exit-code --heads origin gh-cache >/dev/null; then
97+
|| { echo "No changes to commit"; exit 0; }
98+
# Push with retry to handle concurrent updates to gh-cache
99+
for attempt in 1 2 3; do
100+
if git push origin gh-cache 2>/dev/null; then
101+
echo "Pushed to 'gh-cache' branch"
102+
break
103+
fi
104+
echo "Push failed (attempt $attempt), rebasing and retrying..."
99105
git fetch origin gh-cache
100106
git rebase origin/gh-cache
101-
fi
102-
git push origin gh-cache
107+
done
103108
else
104109
echo "'${{ inputs.path }}' does not exist"
105110
echo "Skipping commit and push"

0 commit comments

Comments
 (0)