Skip to content

Commit

Permalink
GitHub CI: Use a custom "Check for uncommited changes" step that reli…
Browse files Browse the repository at this point in the history
…es on GitHub env variables
  • Loading branch information
adamziel committed Feb 29, 2024
1 parent d5a5321 commit 207b1bc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/refresh-wordpress-major-and-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@ jobs:
run: npx nx bundle-wordpress:major-and-beta playground-wordpress
- name: Check for uncommitted changes
id: changes
uses: mskri/[email protected]
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "No changes"
echo 'CHANGES=0' >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo 'CHANGES=1' >> $GITHUB_OUTPUT
fi
- name: Push rebuilt WordPress to GitHub
if: steps.changes.outputs.outcome == failure()
if: steps.changes.outputs.CHANGES == '1'
run: |
git config --global user.name "deployment_bot"
git config --global user.email "[email protected]"
Expand All @@ -49,7 +56,7 @@ jobs:
git push origin HEAD:trunk
fi;
- name: Deploy website
if: steps.changes.outputs.outcome == failure()
if: steps.changes.outputs.CHANGES == '1'
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build-website.yml
Expand Down

0 comments on commit 207b1bc

Please sign in to comment.