65

Since the 3rd of May this month, github added the setting Allow GitHub Actions to create and approve pull requests for creating pull requests in github actions, under Settings > Actions > General. However, it seems I cannot select this option for my repo, it is grayed out without any explanation why it is grayed out.

Whenever the "default permissions" setting is changed and saved, it is possible to select the Allow GitHub Actions to create and approve pull requests, but if it is saved it snaps back to the original grayed out version, unchecked.

I also tried giving the workflow file the pull-request permission like so:

permissions:
   pull-requests: write

but that didn't work either. Is there something I am missing which prevents me from using pull requests within github actions?

'Allow GitHub Actions to create and approve pull requests' setting Failing GitHub Actions PR creation

6
  • Are you trying this on a personal account in a private repo? Commented May 25, 2022 at 12:13
  • I am trying this on a public repo in an organisation. Commented May 25, 2022 at 13:10
  • Are you an admin in your org? Commented May 25, 2022 at 13:26
  • Yes, I created the organisation. So it seems there is an organisational setting which you can toggle, but not per repo Commented May 25, 2022 at 15:52
  • 2
    sorry, correction, you can toggle the setting if the organisational setting has been toggled on, thanks for looking in the right direction! Commented May 25, 2022 at 15:59

3 Answers 3

130

You are probably using an organization, which means you must first enable this behavior on the organization level and then on the repository level

  1. Go to https://github.com/organizations/YOUR_ORG/settings/actions and check Allow GitHub Actions to create and approve pull requests
  2. Then go to https://github.com/YOUR_ORG/YOUR_REPO/settings/actions and check the box that previously was grayed out
Sign up to request clarification or add additional context in comments.

5 Comments

Great, thank you! Seems step 2 wasn't required in my case, because it was already checked by the first step I guess.
0. If you are using GitHub Enterprise, you need to check the box there also github.com/enterprises/YOUR_ENTERPRISE/settings/actions Additionally it seems to enable it in the organization and repositories by default after enabling it in the enterprise.
A million thanks @aviggiano
I would love to know why allowing pull requests seems to be more heavily guarded than read/write access to the repository. Is there a security caveat that's not intuitive here?
Thanks. This was a horrible choice in terms of UI/UX from GitHub :/
4

On top of Aviggiano's reply. In case you have an Enterprise level account, the settings to Allow GitHub Actions to create and approve pull requests have to be set at the Enterprise settings level and not at the Organization level.

https://github.com/enterprises/<YOUR_ORG>/settings/actions

Comments

1

If you are using your personal GitHub Account like me, and you face similar problem, here are what you can do to solve the problem

Step 1. Navigate to Repo > Settings > Actions. Something like: https://github.com/<YOUR-PROFILE>/<YOUR-REPO>/settings/actions.

Step 2: Choose Read and write permissions option to allow workflow with read & write permissions in the repository for all scope.

repo workflow permissions

Hope it helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.