Pushing to a protected branch while preventing infinite loop #298
-
I have a protected branch I though about enabling force push to this branch for specific user ( machine user ) but all the examples i see online require giving the machine user PAT to the workflow which may lead to the same issue. Thanks for the help in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The best way to protect you from infinite loops is to add a guard to your workflows. name: Deploy
on:
push:
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
# Run this job if the commit message is not equal to "::your-commit-message::"
if: github.event.head_commit.message != '::your-commit-message::'
steps:
- run: # Deploy code If your commit message is not static, you can of course change the guard to look for a different values. You can find the entire object structure of Related Discussions: |
Beta Was this translation helpful? Give feedback.
Actually I solved it by adding [skip-ci] to the commit message of the auto-commit.