Add auto-approval before merging PR for develop updates#14
Conversation
Merge main into develop to update the develop branch to the latest version
There was a problem hiding this comment.
Pull Request Overview
This PR adds an auto-approval step before merging pull requests that update the develop branch to match main, attempting to satisfy potential branch protection requirements.
Key Changes:
- Added
gh pr review --approvecommand to automatically approve the PR before merging - Modified the merge command to include the
--autoflag, changing from immediate merge to enabling auto-merge
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Approve PR | ||
| gh pr review "${{ steps.create_pr.outputs.URL }}" --approve --body "Auto-approved by CI for merging develop update." |
There was a problem hiding this comment.
This approval step will fail. The default GITHUB_TOKEN cannot be used to approve pull requests that were created by the same token, as this is a GitHub Actions security restriction. You'll need to use a different authentication method, such as a GitHub App token or a personal access token (PAT) with appropriate permissions.
Consider using a GitHub App or storing a PAT in secrets and using it for the approval step:
gh pr review "${{ steps.create_pr.outputs.URL }}" --approve --body "Auto-approved by CI for merging develop update."
env:
GITHUB_TOKEN: ${{ secrets.APPROVER_TOKEN }}| gh pr review "${{ steps.create_pr.outputs.URL }}" --approve --body "Auto-approved by CI for merging develop update." | ||
|
|
||
| # Merge PR | ||
| gh pr merge "${{ steps.create_pr.outputs.URL }}" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge --auto |
There was a problem hiding this comment.
The --auto flag changes the merge behavior from immediately merging the PR to enabling auto-merge, which requires branch protection rules with required status checks or approvals. If branch protection is not configured with auto-merge enabled, this command will fail.
If you intend to merge immediately (as the original code did), remove the --auto flag. If you want to enable auto-merge and wait for conditions to be met, ensure your repository has the appropriate branch protection rules configured for the develop branch.
For immediate merge (original behavior):
gh pr merge "${{ steps.create_pr.outputs.URL }}" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge| gh pr merge "${{ steps.create_pr.outputs.URL }}" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge --auto | |
| gh pr merge "${{ steps.create_pr.outputs.URL }}" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge |
No description provided.