如何在 GitHub Action 中推送到受保护的分支

bib*_*ibi 6 github-actions

我有一个 GitHub Action 工作流程来创建新版本并在合并到我们的 master 分支后发布。但是,master 分支有一个保护。1 已成功测试的解决方案是创建具有管理员权限的 PAT,然后使用它来代替生成的令牌具有有限权限的 GitHub Action,取消选中分支保护规则上的“包括管理员”。我们不想取消选中分支保护规则上的“包括管理员”。请问有没有办法解决这个问题,而不需要更改我们的主分支的分支保护规则的任何内容。提前谢谢大家!!

steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
          persist-credentials: false

      - name: Changelog Actions
        id: changelog
        uses: TriPSs/conventional-changelog-action@v3
        with:
          github-token: ${{ secrets.PAT_ACCESS }} 

      - name: create releases
        uses: actions/create-release@v1
        if: ${{ steps.changelog.outputs.skipped == 'false'}}
        env:
          GITHUB_TOKEN: ${{ secrets.PAT_ACCESS }}  
        with:
          tag_name: ${{ steps.changelog.outputs.tag }}
          release_name: ${{ steps.changelog.outputs.tag }}
          body: ${{ steps.changelog.outputs.clean_changelog }}

Error message generated when run with "include administrators" branch protection rule in place

remote: error: GH006: Protected branch update failed for refs/heads/master.        
remote: error: At least 1 approving review is required by reviewers with write access.        
Run Code Online (Sandbox Code Playgroud)