Branch "x" is not allowed to deploy to github-pages due to environment protection rules. #39054
-
Select Topic AreaGeneral BodyI've created a new repository to host a private Pages site. We're on Enterprise. I'm using the recommended set-up for a Next Js site. Whether I deploy on main or any other branch I get this error. I don't have any branch protection rules. I can push changes to any branch. Please can you help me understand how to deploy a pages site? Or how to add or remove a protection rule so that I can deploy. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 16 comments 10 replies
-
OK I've found the problem. Workflow creates an environment called |
Beta Was this translation helpful? Give feedback.
-
Just to elaborate on this, this can be done by visiting settings for your repo, then "Environments", then "github-pages", then changing the allowed branch. |
Beta Was this translation helpful? Give feedback.
-
Hello. I have the same problem, action says it cannot deploy from branch, but it's a tag. |
Beta Was this translation helpful? Give feedback.
-
I am having the same issue, what's the status of this please? |
Beta Was this translation helpful? Give feedback.
-
Same issue here, can't deploy from a tag with branch protection rule starting yesterday |
Beta Was this translation helpful? Give feedback.
-
Same issue here... It started to happen yesterday. |
Beta Was this translation helpful? Give feedback.
-
Same here for a tag. :( However, this topic may be unrelated. I posted another discussion for the tag issue: |
Beta Was this translation helpful? Give feedback.
-
We are also having the same issue, it started happening on 10th August and it is probably due to this: https://github.blog/changelog/2023-08-10-actions-runs-triggered-from-tags-or-forks-with-the-same-name-as-a-protected-branch-will-now-be-blocked/ Right now, it breaks all of our projects. |
Beta Was this translation helpful? Give feedback.
-
Same issue here, I can't trigger build because github actions are returning |
Beta Was this translation helpful? Give feedback.
-
This is currently happening within our project also. For example, previous version was deployed successfully through the workflow and it was "v0.10.2", now it's failing due to protection rules |
Beta Was this translation helpful? Give feedback.
-
it seems like GitHub doesn't know the difference between branches and tags |
Beta Was this translation helpful? Give feedback.
-
Same here. We are deploying to The only solution that works for us now is to allow all branches, which is obviously much worse. Is that really the plan? |
Beta Was this translation helpful? Give feedback.
-
instead of / use ./ |
Beta Was this translation helpful? Give feedback.
-
works for me |
Beta Was this translation helpful? Give feedback.
-
Another cause for this problem can be that the GitHub Pages source is set to "Deploy from branch" at
To fix it, set the source to "GitHub Actions". This fixed it for me on a repository which used to use |
Beta Was this translation helpful? Give feedback.
OK I've found the problem. Workflow creates an environment called
github-pages
which did indeed have a protection rule of branchmaster
. Shortly after creating the repo I renamed default branch tomain
. So I had to update the env protection rule to match default branch and deployment worked.