File tree Expand file tree Collapse file tree
.github/actions/gh-cache/save Expand file tree Collapse file tree Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments