File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,12 @@ runs:
146146 working-directory : .github/${{ inputs.gitops-repository }}
147147 shell : bash
148148 run : |
149+ push_to_gitops_repo () {
150+ # In case there was another push in the meantime, we pull it again
151+ git pull --rebase https://${{ inputs.gitops-user }}:${{ inputs.gitops-token }}@github.com/${{ inputs.gitops-organization }}/${{ inputs.gitops-repository }}.git
152+ git push https://${{ inputs.gitops-user }}:${{ inputs.gitops-token }}@github.com/${{ inputs.gitops-organization }}/${{ inputs.gitops-repository }}.git
153+ }
154+
149155 commit_changes () {
150156 if [[ ${{ steps.preparation.outputs.push }} == "true" ]]; then
151157 git add .
@@ -157,9 +163,9 @@ runs:
157163 fi
158164
159165 git commit -m "Release ${{ inputs.docker-registry }}/${{ inputs.docker-image }}:${{ steps.preparation.outputs.tag }}"
160- # In case there was another push in the meantime, we pull it again
161- git pull --rebase https://${{ inputs.gitops-user }}:${{ inputs.gitops-token }}@github.com/${{ inputs.gitops-organization }}/${{ inputs.gitops-repository }}.git
162- git push https://${{ inputs.gitops-user }}:${{ inputs.gitops-token }}@github.com/${{ inputs.gitops-organization }}/${{ inputs.gitops-repository }}.git
166+
167+ # retry push attempt since rejections can still happen (even with pull before push)
168+ push_to_gitops_repo || push_to_gitops_repo || push_to_gitops_repo
163169 fi
164170 }
165171
You can’t perform that action at this time.
0 commit comments