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

Need to clarify docs about a hidden GitHub pages requirement on private repository #349

Closed
huy-nguyen opened this issue Jun 13, 2020 · 14 comments
Assignees
Labels

Comments

@huy-nguyen
Copy link

huy-nguyen commented Jun 13, 2020

Is your feature request related to a problem? Please describe

I created a new repo and use this action to publish to the gh-pages branch but the repo's supposed GitHub page returned a 404 even after choosing gh-pages branch from the dropdown in the repo's GitHub pages setting.

I contacted GitHub support about this and their response was

In order to be built and published for the very first time, a GitHub Pages repository must have a commit pushed to it by a user with admin permissions for the repository. In this case, it looks like while you committed to the master branch, the only commit pushed to the gh-pages branch was from github-actions.

Following this tip fixed my problem.

Describe the solution you'd like

Add an explanation to the docs. The easiest solution would be for the user to push any content under their own account to the gh-pages branch and after that this action can take over the publishing.

Describe alternatives you've considered

There's no alternatives. This seems to be a GitHub requirement.

Additional context

@peaceiris
Copy link
Owner

peaceiris commented Jun 13, 2020

Thank you for suggesting this!

Now, we have an explanation about this in the First Deployment with GITHUB_TOKEN section.

The GITHUB_TOKEN has limitations for the first deployment so we have to select the GitHub Pages branch on the repository settings tab. After that, do the second deployment like the following pictures.

Should we put it on the top of the README?


The easiest solution would be for the user to push any content under their own account to the gh-pages branch and after that this action can take over the publishing.

I am investigating it.

@peaceiris peaceiris added the enhancement New feature or request label Jun 13, 2020
@huy-nguyen
Copy link
Author

What I did was running the action, choose the gh-pages branch, run the action again, which is essentially your "doing 2 deployments" solution but that didn't fix the problem. I think the problem here was that the github action is not considered "a user with admin permissions." Maybe you can do some testing on your own to validate my findings?

@peaceiris
Copy link
Owner

What I did was running the action, choose the gh-pages branch, run the action again, which is essentially your "doing 2 deployments" solution but that didn't fix the problem.

When we have no change in deployment assets, we get the message nothing to commit, working tree clean and deployment will be skipped. Was your second deployment skipped? Please check your log like this.

GitHub Pages log

I think the problem here was that the github action is not considered "a user with admin permissions." Maybe you can do some testing on your own to validate my findings?

Yes. This is a problem we have been facing for several months. You can see the first discussion and investigation of deployment with GITHUB_TOKEN at #9. Some of the problems have been solved and others (this issue!) are still opened today. This is an inside authentication problem of GitHub Pages and GitHub service. Currently, we have no solution to this, (only GitHub developer team can work on this) I think.

@peaceiris
Copy link
Owner

peaceiris commented Jun 14, 2020

I have tested this at peaceiris/test-docusaurus now. It works well for me.

  1. Delete the gh-pages branch for testing
  2. Do the first deployment (I added allow_empty_commit for testing)
  3. Click the gh-pages branch button in the settings tab.
  4. Do the second deployment
  5. I got the following log (GitHub Pages enabled successfully)

GitHub Pages deployment log with GitHub Actions

@letmaik
Copy link

letmaik commented Jun 20, 2020

I had the same issue. On a new repository, I followed the two-step instructions but it was impossible to get it deployed. The only way out was to manually push a commit to gh-pages. And after that the automatic deploys worked.

@huy-nguyen
Copy link
Author

@letmaik that was what I was trying to tell the maintainer.

@peaceiris
Copy link
Owner

peaceiris commented Jun 21, 2020

OK. @huy-nguyen and @letmaik
Could you share your public repository for reproducing?

Now, I deleted peaceiris/test-docusaurus and deployed it again with the 2-step instructions. It works well. I could not get a failure case on my side.

Screen Shot 2020-06-21 at 13 55 02

@peaceiris
Copy link
Owner

peaceiris commented Jun 21, 2020

I got it. Your problems are related to a private repository, right?

I could reproduce it on my side.

Screen Shot 2020-06-21 at 14 44 22

Now, we have no solution on the actions-gh-pages side. I am investigating it. (A month or a few weeks ago, it worked well. This is a new problem of the GitHub's internal authentication.)

Anyway, we need to announce this case on our README.

Thank you!

@peaceiris peaceiris changed the title Need to clarify docs about a hidden GitHub pages requirement Need to clarify docs about a hidden GitHub pages requirement on private repository Jun 21, 2020
@letmaik
Copy link

letmaik commented Jun 21, 2020

@peaceiris Yes, it's a private one.

@huy-nguyen
Copy link
Author

huy-nguyen commented Jun 21, 2020

Yes this only happens for private repos because since GitHub changed their pricing structure recently, only paid accounts can have GitHub pages for private repos.

@sl4m
Copy link

sl4m commented Jun 24, 2020

Glad I found this issue. I was having trouble with a private repo myself and found that pushing a manual commit to gh-pages branch solved the problem as suggested.

@peaceiris If you need some help with the README for this particular issue, let me know

@chatziko
Copy link

chatziko commented Jul 5, 2020

I'm also affected by this and I did lots of tests. It seems to me that on a private repo, none of the 3 authentication methods currently works, I tried github_token, deploy_key and personal_token and get the same behaviour:

  • the action runs fine
  • the master branch is updated
  • gh-pages log says deployed
  • but serves the old version.

I even tried a personal token + manually asking for a build:

    - name: Deploy
      uses: peaceiris/actions-gh-pages@v3
      with:
        personal_token: ${{ secrets.PERSONAL_TOKEN }}
        publish_branch: master
        publish_dir: ./public
        force_orphan: true

    - name: Request Github Pages build job
      run: >-
        curl -L -X POST
        -H "Content-Type: application/json"
        -H "Authorization: token ${{ secrets.PERSONAL_TOKEN }}"
        "https://api.github.com/repos/${{ github.repository }}/pages/builds"

Same thing.

I also tried a personal ssh key (configured in my personal settings, not a deploy key), even that does not work.

At the same time, manually pushing an empty commit to the master branch updates the served page within a few seconds.

I guess something is seriously wrong on the guthub side, I hope they fix it soon.

peaceiris added a commit that referenced this issue Jul 10, 2020
peaceiris added a commit that referenced this issue Jul 10, 2020
@peaceiris peaceiris pinned this issue Jul 10, 2020
@peaceiris
Copy link
Owner

I tested a new public repository and a new private repository. They work well with github_token: ${{ secrets.GITHUB_TOKEN }}. Thank you all.

@peaceiris peaceiris unpinned this issue Oct 7, 2020
peaceiris added a commit that referenced this issue Oct 7, 2020
@github-actions
Copy link
Contributor

This issue has been LOCKED because of it being resolved!

The issue has been fixed and is therefore considered resolved.
If you still encounter this or it has changed, open a new issue instead of responding to solved ones.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants