English 中文(简体)
即使允许武力推推,吉图比保护的分钩也下降了
原标题:Github protected branch hook declined even with allow force pushes
I have a branch protection to my test branch, but i need to execute every pull request merged a action to update the version of the software and commit in the test branch. Even with the tag --force the error appear: INPUT_TAGGING_MESSAGE: No tagging message supplied. No tag will be added. INPUT_PUSH_OPTIONS: --force remote: error: GH006: Protected branch update failed for refs/heads/test. remote: error: Changes must be made through a pull request. ! [remote rejected] HEAD -> test (protected branch hook declined) error: failed to push some refs to https://github.com/***/*** Error: Invalid status code: 1 at ChildProcess. (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19) at ChildProcess.emit (node:events:390:28) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) { code: 1 } Error: Invalid status code: 1 at ChildProcess. (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19) at ChildProcess.emit (node:events:390:28) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) I allowed everyone to push with force in this branch: My workflow action: name: Version Update on: pull_request: branches: - master - test types: [closed] jobs: version_update: runs-on: ubuntu-latest if: github.event.pull_request.merged == true steps: - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e with: php-version: 8.1 - name: Get branch name id: branch-name uses: tj-actions/branch-names@v6 - uses: actions/checkout@v3 with: ref: ${{ steps.branch-name.outputs.base_ref_branch }} - name: Copy .env run: php -r "file_exists( .env ) || copy( .env.example , .env );" - name: Install Dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - name: Generate key run: php artisan key:generate - name: Update Patch Version if: steps.branch-name.outputs.current_branch != test run: php artisan version:patch - name: Update Minor Version if: steps.branch-name.outputs.current_branch == test run: php artisan version:minor - name: Update Timestamp run: php artisan version:timestamp - name: Update Commit run: php artisan version:absorb - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: "version: update patch" branch: ${{ steps.branch-name.outputs.base_ref_branch }} push_options: --force
最佳回答
If the branch protection is active and the option "Require a pull request before merging" is marked, this will prevent any push even with --force to go to your protected branch. In the github is impossible to push in a branch with option "Require a pull request before merging" My solution for this problem is to work without this option.
问题回答
There is a "Allow specified actors to bypass required pull requests" option nested under "Require a pull request before merging". Enable that and put in the user used to run the actions as exception worked for me. Note that we created a GitHub App identity as "the exception user", added that to the exception list and use that to run the workflow (we use https://github.com/getsentry/action-github-app-token to load token from GitHub App to run workflow) because we don t know how to reference the "default user used to run action workflows".
In my case, running the command git push origin HEAD fixed the problem.
for me the setup that worked is a ci user with admin permissions. create github token for that user and include in the checkout step: - uses: actions/checkout@v4 with: token: ${{ secrets.DEPLOY_GH_TOKEN }}




相关问题
GitHub SAML SSO ( cloud enterprise)

I wanted to integrate GitHub saml sso for the project. I have a custom IDP and from the SP initiated saml flow, like getting to the https://github.com/orgs/ORG-NAME/sso and then sso getting successful,...

How do I clone a github project to run locally?

I am trying to follow this railscast tutorial for authlogic - and it points to the source here - I have git installed - how do I replicate the source onto my localhost so that I can follow the ...

git push heroku master permission denied on VISTA

(Using Vista)I m trying to clone an app from my GitHub Repository and push it into Heroku. Okay, so I ve tried to create an SSH key so many times with this: `ssh-keygen -t rsa` It seems to go ...

SSH Public key denied on "git clone" command

I am trying to clone a git repo that I forked in my GitHub Repository.It s a rails app. I want to clone it on my local git so that I can push it onto heroku. I generated a set of rsa keys and copied ...

heroku using git branch is confusing!

Ok, so I have a big github project that i m not supposed to merge my little Stacia branch into. However, it seems like Heroku only takes pushing MASTER seriously. It looks like I pushed my branch, but ...

热门标签