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

GitHub Pages build failed #48

Closed
freearhey opened this issue Nov 13, 2019 · 21 comments
Closed

GitHub Pages build failed #48

freearhey opened this issue Nov 13, 2019 · 21 comments
Assignees
Labels
bug 🐦 Something isn't working version 2 Issues related to version 2 of this action. version 3 Issues related to version 3 of this action.

Comments

@freearhey
Copy link

freearhey commented Nov 13, 2019

What's the problem?

Every time an action is triggered, I get the "Your site is having problems building: Page build failed." error.

I tried to replace GITHUB_TOKEN: ${{ secret.GITHUB_TOKEN }} with ACCESS_TOKEN: ${{ secret.REPO_SCOPED_TOKEN }}.

Didn't help.

I tried to add a .nojekyll file to the build.

Didn't help.

I tried using JamesIves/github-pages-deploy-action@releases/v3.

Didn't help.

I tried to add a .nojekyll file directly to gh-pages branch.

But,

You can safely commit these files directly into deployment branch without them being overridden after each deployment

is definitely not true. All files are erased every time.

Expected behavior

No errors will occur after deployment.

Therefore, I would appreciate any help in solving this problem.

@freearhey
Copy link
Author

freearhey commented Nov 13, 2019

And yes, I forgot to mention, if I make any changes to the gh-pages branch after deployment, the error disappears.

@JamesIves JamesIves added bug 🐦 Something isn't working researching 📒 Currently researching potential fixes. version 2 Issues related to version 2 of this action. version 3 Issues related to version 3 of this action. labels Nov 13, 2019
@JamesIves
Copy link
Owner

JamesIves commented Nov 13, 2019

I've noticed this too and I've been holding back on releasing the new version because of it. I've emailed GitHub support about it with a very vague response from them. It seems like something has changed this last week, because previously the error was only caused if you are using a GitHub token, but they told me it's because a human didn't trigger the build even though an access token with a very greedy permission scope was used.

Oh interesting - we'll dig into this more and followup if we have more questions.

I've also posted about it here: https://github.community/t5/GitHub-Actions/Github-action-not-triggering-gh-pages-upon-push/m-p/38065/highlight/true#M3210 and here: https://github.community/t5/GitHub-Pages/Cannot-Build-Page/m-p/37618#M2324 but have yet to receive any actionable response.

@tcbyrd - If you're available are you able to look into this? I have a test repo with the issue: https://github.com/JamesIves/doughnut-generator

@JamesIves JamesIves added the help wanted 📲 Extra attention is needed label Nov 13, 2019
@JamesIves JamesIves self-assigned this Nov 13, 2019
@JamesIves
Copy link
Owner

Also @freearhey some of the issues you're referring to such as the CNAME and .nojekyll items are only relevant to v3, which hasn't been released yet. If you're using v2 you need to follow the steps in that README.

@freearhey
Copy link
Author

@JamesIves I brought the text from the docs of v3 precisely because I tried to use v3 in this case. At that time, I thought that the problem could be precisely that .nojekyll is recreated every time from scratch. When using v2, of course I was guided by the documentation for v2.

@JamesIves
Copy link
Owner

@JamesIves I brought the text from the docs of v3 precisely because I tried to use v3 in this case. At that time, I thought that the problem could be precisely that .nojekyll is recreated every time from scratch. When using v2, of course I was guided by the documentation for v2.

Please follow the instructions here to try the beta of v3 - https://github.com/JamesIves/github-pages-deploy-action/tree/releases/v3-beta

If you're still experiencing the issue you mentioned with the CNAME files please open a new issue. I'd like to keep this on-topic for the deployment issue.

@Fndroid
Copy link

Fndroid commented Nov 17, 2019

Same issue. All actions run passed but Github page deploy failed.
image

@linbudu599
Copy link

I also got depressed by this problem..., I found something special, the first time you run the action in v2/v3, the page will be built successfully, but if u update sth and push, when the action goes there will be one more workflow 'github pages', although it shows success the page still failed in building.
image

@shilangyu
Copy link

This seems to be a problem for all gh-pages deploy actions. Switching to master branch in settings/Github_Pages and then switching back to gh-pages cause it to deploy correctly

@JamesIves
Copy link
Owner

JamesIves commented Nov 19, 2019

Just got word back from GitHub support. Essentially what's happening here is that the GITHUB_TOKEN is being persisted by another action, causing the failure when it gets to the deploy step because of the existence of a GITHUB_TOKEN.

Update the actions/checkout step in your config to point to v1 and this issue should be resolved.

    steps:
    - name: Checkout
      uses: actions/checkout@v1

Just tested it and it worked for me. Please let me know if you have similar luck, I've updated the action config examples in the README if you want to take a look there.

With that being said I'm going to push up v3 today.

@shilangyu
Copy link

I used v2 and releases/v3 of github-pages-deploy-action with checkout@v1 to no avail. Getting the same error 'GitHub Pages build failed'. Heres an example project. Its hosted on shilangyu.dev/actions-testing and you can see the content does not match the gh-pages branch.

@JamesIves
Copy link
Owner

I used v2 and releases/v3 of github-pages-deploy-action with checkout@v1 to no avail. Getting the same error 'GitHub Pages build failed'. Heres an example project. Its hosted on shilangyu.dev/actions-testing and you can see the content does not match the gh-pages branch.

Try changing GITHUB_TOKEN out for a personal access token in the deploy step and it should work.

@JamesIves JamesIves removed help wanted 📲 Extra attention is needed researching 📒 Currently researching potential fixes. labels Nov 19, 2019
@freearhey
Copy link
Author

Changing the actions/checkout version to v1 really helped. I also had to roll back to JamesIves/github-pages-deploy-action@master because v3 currently causes a 'Cannot read property 'name' of undefined' error. But the main problem is solved, so thank you anyway!

@JamesIves
Copy link
Owner

JamesIves commented Nov 19, 2019

@freearhey Can you open another issue with the v3 issue with the logs? Would super appreciate it!

@shilangyu
Copy link

shilangyu commented Nov 19, 2019

Try changing GITHUB_TOKEN out for a personal access token in the deploy step and it should work.

This does work. Let's hope GITHUB_TOKEN gets a fix soon

@JamesIves
Copy link
Owner

From what I understand it's in the works on GitHubs end, but not ready yet. This action just supports it for when it does work. I pre-maturely added it because people kept trying it anyway,.

timja pushed a commit to hmcts/hmcts.github.io that referenced this issue Jan 19, 2020
njrich28 pushed a commit to hmcts/hmcts.github.io that referenced this issue Jan 20, 2020
@leoglobant
Copy link

@JamesIves I'm getting this issue, switching to v1 didn't help. I'm already setting with: token with a PAT. I'm using Github Enterprise. Any clue?

@JamesIves
Copy link
Owner

@JamesIves I'm getting this issue, switching to v1 didn't help. I'm already setting with: token with a PAT. I'm using Github Enterprise. Any clue?

This is a very old issue. Please create a new issue or discussion that outlines your problem and I'll do my best to support.

@pavelkornev
Copy link

pavelkornev commented Sep 15, 2022

@JamesIves I'm facing the same issue as @leoglobant... using GitHub Enterprise, once deployed by this GH Action — build fails, if I deploy the same files manually — everything works.

I do have

permissions:
  contents: write

in the workflow file and using checkout@v2 and github-pages-deploy-action@v4

And I see that files are deployed/committed properly to gh-pages branch. I don't understand what is the root cause of such GitHub behaviour. Any suggestions?

@pavelkornev
Copy link

pavelkornev commented Sep 15, 2022

Switching to use Token instead of permissions in the workflow file helped me to solve the issue (maybe update documentation?).

@dayo09
Copy link

dayo09 commented Nov 23, 2022

Switching to use Token instead of permissions in the workflow file helped me to solve the issue (maybe update documentation?).

This issue helped me a lot :-D Thanks.

To be specific, I registered a PAT of maintainer account and passed it as github-pages-deploy-action's token, and it works now.

In my case, I hadn't set with: token: at all, but my workflow worked well. It's because the action's always triggered by maintainers, so it was given the default GITHUB_TOKEN enough to push to gh-pages.
However, for some reason, it seems not to have enough permission to deploy github pages.
So I set PAT of maintainer account as github-pages-deploy-action's token and all is fine now.

Reference:

https://docs.github.com/en/enterprise-server@3.5/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#troubleshooting-publishing-from-a-branch

Who can use this feature

People with admin or maintainer permissions for a repository can configure a publishing source for a GitHub Pages site.

Note: If your site has not published automatically, make sure someone with admin permissions and a verified email address has pushed to the publishing source.

@james-s-w-clark
Copy link

For me, on Checkout v1 / v3 in GitHub Enterprise, setting write permissions as the readme suggested didn't help - still get Your site is having problems building: Page build failed.

Switching GH Pages to main and back to gh-pages fixes the error, and the website looks good (temporary manual solution, to prove the files are correct).

I will try the token suggestion above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐦 Something isn't working version 2 Issues related to version 2 of this action. version 3 Issues related to version 3 of this action.
Projects
None yet
Development

No branches or pull requests

9 participants