'Bypass required Status Checks in GitHub

I am trying to use GitHub Actions to automatically increment the version of my project while building the artifact and check the new changes back into the main branch.

The workflow pushes the commit using a PAT for an account that is used only for this purpose so I was able to exclude that user from the branch protection rule requiring a PR for the main branch.

Because there is also a Required Status check for that branch the push fails with

remote: error: GH006: Protected branch update failed for refs/heads/main.        
remote: error: Required status check "build / tests" is expected.   

How can I have the version commits skip this check while enforcing this check for all other commits?



Solution 1:[1]

I faced the same problem few days back. In case you're using standard-version then in the package.json you can do something like:

"standard-version": {
    "releaseCommitMessageFormat": "chore(release): {{currentTag}}\n[ci skip]",
  },

and in the Github Workflow build / tests you can add a condition to skip tests in case a push is tagged with [ci skip] like this:

if: "!contains(github.event.head_commit.message, '[ci skip]')"

Reference

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vsr