Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch is not allowed to deploy to github-pages #1376

Closed
1 task
odwrotnie opened this issue Aug 21, 2022 · 11 comments
Closed
1 task

Branch is not allowed to deploy to github-pages #1376

odwrotnie opened this issue Aug 21, 2022 · 11 comments
Labels
help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. improve documentation Enhance existing documentation (e.g. add an example, improve description)

Comments

@odwrotnie
Copy link

What version of astro are you using?

1.0.6

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

After step by step from https://docs.astro.build/en/guides/deploy/github/ - the Action says:

Branch "main" is not allowed to deploy to github-pages due to environment protection rules.

Link to Minimal Reproducible Example

https://github.com/instap-app/website-definition/actions/runs/2897989697

Participation

  • I am willing to submit a pull request for this issue.
@FredKSchott FredKSchott transferred this issue from withastro/astro Aug 21, 2022
@sarah11918 sarah11918 added improve documentation Enhance existing documentation (e.g. add an example, improve description) help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. labels Aug 22, 2022
@swift502
Copy link
Contributor

swift502 commented Aug 22, 2022

Probably related to #1355.

@odwrotnie Can you try switching your Settings > Pages > Source to "GitHub Actions" and see if that works?

image

@swift502
Copy link
Contributor

swift502 commented Aug 22, 2022

What's baffling to me is that there's nearly a hundred repositories using the withastro/action@v0 workflow action, and they seem to work just fine. Did nobody have issues with this until now? Did something recently change that makes the GitHub deployment guide outdated?

@kevinzunigacuellar
Copy link
Member

kevinzunigacuellar commented Aug 22, 2022

What's baffling to me is that there's nearly a hundred repositories using the withastro/action@v0 workflow action, and they seem to work just fine. Did nobody have issues with this until now? Did something recently change that makes the GitHub deployment guide outdated?

Sorry for the inconvenience, we switched actions lately from actions-gh-pages to deploy-pages to a wrapper with withastro/action. Some configuration options or steps were probably left out from previous versions. Thank you for raising issues 😇, this helps other community members to have a better experience.

@odwrotnie
Copy link
Author

odwrotnie commented Aug 25, 2022

Can you try switching your Settings > Pages > Source to "GitHub Actions" and see if that works?

Switching didn't help :(.

@swift502
Copy link
Contributor

@odwrotnie Interesting, can you look into Settings > Environments and report what you see? You should see a github-pages environment:

image

And inside of it a deployment branch rule that's just the name of your deployment branch. In your case "main".

image

Alternatively, you should just be able to switch from "Selected branches" to "All branches" to remove all branch restricitons.

@odwrotnie
Copy link
Author

This is exactly what I see:

image

Insied was gh-pages.

I have changed to "main" and it worked!

@swift502
Copy link
Contributor

I'm not sure why this breaks occasionally. It's supposed to automatically set itself up when you switch the source to GitHub actions..

Let's hope it's a rare issue.

@odwrotnie
Copy link
Author

There is another issue I suppose:

Take a look at this: https://instap-app.github.io/website-definition/

The assets are linked like https://instap-app.github.io/assets/index.26638c6a.css and should be: https://instap-app.github.io/website-definition/assets/index.26638c6a.css.

My astro.config.mjs looks like this:

site: 'https://instap-app.github.io'
base: '/website-definition'

@swift502
Copy link
Contributor

swift502 commented Aug 25, 2022

Oh, well.. 😄

Those parameters belong inside of the defineConfig object, not outside of it. https://github.com/instap-app/website-definition/blob/master/astro.config.mjs#L9-L10

Try moving them and redeploy the page.

@odwrotnie
Copy link
Author

Now it works! Thank you! This should be stated more clearly in the docs - I can do it.

@sayandcode
Copy link

@odwrotnie Interesting, can you look into Settings > Environments and report what you see? You should see a github-pages environment:

image

And inside of it a deployment branch rule that's just the name of your deployment branch. In your case "main".

image

Alternatively, you should just be able to switch from "Selected branches" to "All branches" to remove all branch restricitons.

This was exactly my issue. This should also be mentioned in the docs, in case we're not hosting from the default branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. improve documentation Enhance existing documentation (e.g. add an example, improve description)
Projects
None yet
Development

No branches or pull requests

5 participants