Search code examples
github-actionsgithub-cli

GitHub CLI approve Pull Request as different user in GitHub Actions


I have GitHub action that approves a Pull Request:

      - name: Approve a PR
        run: gh pr review --approve "$PR_URL"
        env:
          PR_URL: ${{github.event.pull_request.html_url}}
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

When action runs approval is performed by github-actions. Is there any way to perform gh pr review --approve as different user?


Solution

  • I can just use a token for a different user in GITHUB_TOKEN field.