Skip to content

Add auto-approval before merging PR for develop updates#14

Merged
The0mikkel merged 2 commits intomainfrom
develop
Nov 16, 2025
Merged

Add auto-approval before merging PR for develop updates#14
The0mikkel merged 2 commits intomainfrom
develop

Conversation

@The0mikkel
Copy link
Member

No description provided.

Merge main into develop to update the develop branch to the latest
version
@The0mikkel The0mikkel self-assigned this Nov 16, 2025
Copilot AI review requested due to automatic review settings November 16, 2025 16:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --approve command to automatically approve the PR before merging
  • Modified the merge command to include the --auto flag, changing from immediate merge to enabling auto-merge

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +186 to +187
# Approve PR
gh pr review "${{ steps.create_pr.outputs.URL }}" --approve --body "Auto-approved by CI for merging develop update."
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }}

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Suggested change
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

Copilot uses AI. Check for mistakes.
@The0mikkel The0mikkel merged commit 34f7668 into main Nov 16, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant