Should error after commit #373
Closed
Dreamsorcerer
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
Thanks for the suggestion. I personally don't see that this is as the expected behaviour. In your use case, you might run a linter and you might want the workflow to fail. However, you can build this feature on your own by using the output of git-auto-commit. Here's an example workflow (not tested) that checks the name: Check and Fail on Changes
on:
push:
branches:
- main
jobs:
check-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run php-cs-fixer or other formatting tool
run: |
# Replace this with your actual formatting command
php-cs-fixer fix .
- name: Auto-commit changes
uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit-action
with:
commit_message: Apply php-cs-fixer changes
- name: Fail workflow if changes have been detected
if: steps.auto-commit-action.outputs.changes_detected == 'true'
run: |
echo "Changes were detected and committed. Failing the workflow."
exit 1 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Expected behaviour:
The CI should error and exit after a commit is made (in the typical usecase of auto-commiting fixes, e.g. from a linter).
Actual behaviour:
The CI continues to run and ends up passing.
I couldn't see any options that would configure this behaviour.
Beta Was this translation helpful? Give feedback.
All reactions