Skip to content

Commit 910ddf0

Browse files
authored
Merge pull request #57 from Staffbase/retry-push-to-mops
🎨 Retry push attempts
2 parents c5cc7a2 + 199fa2d commit 910ddf0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

action.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)