Replies: 9 comments 10 replies
-
I get the same error using the following workflow: name: Dependabot auto-merge
on: pull_request
permissions:
pull-requests: write
contents: write
issues: write
repository-projects: read
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- run: |
gh pr review --approve "$PR_URL"
gh pr edit --add-label "automerge" "$PR_URL"
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} I also tried The PR is approved and tagged, but the last sentence, Any clue what is wrong? Thanks |
Beta Was this translation helpful? Give feedback.
-
The error message you're encountering is "GraphQL: ['Pull request: User is not authorized for this protected branch'] (enablePullRequestAutoMerge)," indicates that your GitHub app does not have the necessary permissions to enable auto-merge on a pull request. To resolve this issue, you'll need to ensure that your GitHub app has the required permissions to perform this action. Here are the steps you can take:
If you've already verified the above and are still facing issues, you might want to reach out to GitHub Support for further assistance, as they can provide more specific guidance based on your GitHub app's configuration and the repository settings. Additionally, ensure that your GitHub app is correctly authenticated and authorized when making API calls to enable auto-merge on pull requests. #67124 |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
The problematic option (now it's obvious.. 🥲 ) was Is there any way to include Thanks everyone for your help! |
Beta Was this translation helpful? Give feedback.
-
same question here |
Beta Was this translation helpful? Give feedback.
-
Has this been addressed yet? |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
I have the same issue. I would like to add Dependabot as a user who can auto merge |
Beta Was this translation helpful? Give feedback.
-
Hi @ThijsBorst @smnieves-cbg @ro3t @szaffarano @timc13 and anyone confronted with the The reason is obviously the Branch Protection-Rule which denys dependabot the merge to your main/master branch. Here is the example, you can search and add renovate to your Repos branch protection rule... ...but dependabot does not appear... Any attempt to add a custom value via the WebUI did not work for me. You should be able to add dependabot via the REST API: https://docs.github.com/en/rest/branches/branch-protection?apiVersion=2022-11-28 Or, you can use the GitHub Repository Settings Bot and a settings.yml to add dependabot, here is the branch part: (CAUTION: This is only the interesting part) repository:
...
allow_auto_merge: true
...
branches:
- name: main
# https://docs.github.com/en/rest/reference/repos#update-branch-protection
# Branch Protection settings. Set to null to disable
protection:
# Required. Require at least one approving review on a pull request, before merging. Set to null to disable.
required_pull_request_reviews:
# The number of approvals required. (1-6)
required_approving_review_count: 1
# Dismiss approved reviews automatically when a new commit is pushed.
dismiss_stale_reviews: true
# Blocks merge until code owners have reviewed.
require_code_owner_reviews: true
# Specify which users and teams can dismiss pull request reviews. Pass an empty dismissal_restrictions object to disable. User and team dismissal_restrictions are only available for organization-owned repositories. Omit this parameter for personal repositories.
# dismissal_restrictions:
# users: []
# teams: []
# Required. Require status checks to pass before merging. Set to null to disable
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: true
# Required. The list of status checks to require in order to merge into this branch
contexts: []
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: false
# Prevent merge commits from being pushed to matching branches
required_linear_history: true
# Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
restrictions:
apps: ["dependabot"]
users: []
teams: []
required_signatures: true
... And now the Repository's branch protection rule looks like this and the pipeline should work: |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
I'm trying to setup a workflow that create a PR and enable auto-merge on it. I've followed the steps laid out here, but for my own bot (not dependabot). This bot does have
content: write
&pull-requests: write
permissions.The error I get is
GraphQL: ["Pull request User is not authorized for this protected branch"] (enablePullRequestAutoMerge)
Beta Was this translation helpful? Give feedback.
All reactions