@@ -85,19 +85,20 @@ jobs:
85
85
\ \" ::set-output name=failed::false\"\n fi\n\n echo \" Git status:\"\n git status\n \
86
86
\n git add -A\n\n if [ -z \" $(git status --porcelain)\" ] ; then\n echo \" \
87
87
No updated workflows; done.\"\n echo \" ::set-output name=skip::true\"\n fi\n "
88
- - name : Commit and PR
88
+ - name : Commit and push or PR
89
89
working-directory : thisrepo
90
90
if : steps.update.outputs.skip != 'true'
91
91
run :
" set -x\n set -o pipefail\n git config --global user.email [email protected] \n \
92
- git config --global user.name \" Leeroy Travis\"\n\n # If we're on a PR branch,\
93
- \ push to it instead of making a new PR branch.\n if ! [ \" ${{ github.ref }}\" \
94
- \ = \" refs/heads/main\" ] ; then\n git commit -m \" Update workflows from\
95
- \ templates.\"\n git push\n exit 0\n fi\n\n NEW_BRANCH=\" workflow-update-$(date\
96
- \ -u '+%Y-%m-%d')\"\n git checkout -b \" ${NEW_BRANCH}\"\n git commit -m \" Update\
97
- \ workflows from templates.\"\n git push -u origin \" ${NEW_BRANCH}\"\n\n # Create\
98
- \ a PR.\n PRBODY=\" Updating from templates.\"\n if [ \" ${{ steps.update.outputs.failed\
99
- \ }}\" == \" true\" ] ; then\n PRBODY=$(printf \" %s\\ n\\ n%s\" \" ${PRBODY}\" \
100
- \ \" @IronCoreLabs/ops patch didn't apply cleanly.\" )\n fi\n # https://github.com/IronCoreLabs/depot/issues/333\n \
92
+ git config --global user.name \" Leeroy Travis\"\n\n git commit -m \" Update\
93
+ \ workflows from templates.\"\n\n # If the update applied cleanly, try pushing\
94
+ \ straight to the branch we're on.\n if [ \" ${{ steps.update.outputs.failed\
95
+ \ }}\" = \" false\" ] && git push ; then\n exit 0\n fi\n\n # Simple push failed.\
96
+ \ We don't care why it failed; we just need to make a PR out of this commit.\n \
97
+ NEW_BRANCH=\" workflow-update-$(date -u '+%Y-%m-%d')\"\n git branch \" ${NEW_BRANCH}\" \
98
+ \n git push -u origin \" ${NEW_BRANCH}\"\n\n # Create a PR.\n PRBODY=\" Updating\
99
+ \ from templates.\"\n if [ \" ${{ steps.update.outputs.failed }}\" == \" true\" \
100
+ \ ] ; then\n PRBODY=$(printf \" %s\\ n\\ n%s\" \" ${PRBODY}\" \" @IronCoreLabs/ops\
101
+ \ patch didn't apply cleanly.\" )\n fi\n # https://github.com/IronCoreLabs/depot/issues/333\n \
101
102
echo \" ${PRBODY}\" > body.txt\n echo -n \" ${NEW_BRANCH}\" > head.txt\n echo\
102
103
\ ${{ steps.update.outputs.failed }} | \\\n jq --rawfile body body.txt --rawfile\
103
104
\ head head.txt \\\n '{\" title\" : \" Update workflows from templates\" ,\n \
0 commit comments