Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Skip gh pages publishing for forks? #136

Open
evalott100 opened this issue May 19, 2023 · 9 comments
Open

Skip gh pages publishing for forks? #136

evalott100 opened this issue May 19, 2023 · 9 comments
Assignees

Comments

@evalott100
Copy link
Collaborator

When a skeleton repo is forked, gh pages publishing will inevitably fail unless the org/user sets up their own docs pages:

  fatal: unable to access 'https://github.com/evalott100/event-model.git/': The requested URL returned error: 403
  Error: Action failed with "The process '/usr/bin/git' failed with exit code 128"

This isn't a huge problem since on a PR to the upstream repo the correct org will be used and doc publishing can be seen to be working before a merge. Though... might be worth skipping this step for forked repos, or fixing it so the upstream org is used? @gilesknap @coretl

@evalott100 evalott100 self-assigned this May 19, 2023
@coretl
Copy link
Contributor

coretl commented May 22, 2023

Interesting, I was under the impression that you could always push to the gh-pages branch of your own fork. Maybe it's not trying to do this. Do you have a link to the actions output that produced this?

@evalott100
Copy link
Collaborator Author

evalott100 commented May 22, 2023

@coretl

https://github.com/evalott100/event-model/actions/runs/5044101600/jobs/9046917635#step:10:196

I'm thinking this is probably a permission thing - setting up the bot incorrectly?

@coretl
Copy link
Contributor

coretl commented May 22, 2023

Surprising, public forks are given a read only token, so cannot write back to the fork:
https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/

This doesn't seem intuitive, I can see why it shouldn't be able to write back to the original repo, but why can't it write to itself? Maybe this is something that #133 would fix for us if we worked out how to make it work with multiple versions...

@gilesknap @garryod any ideas?

@gilesknap
Copy link
Contributor

gilesknap commented May 23, 2023

@coretl my reading of that page is that the fork gets a read only token for actions fired by a pull request back to the original repo. The implication being that it has the usual permissions for its own actions.

I thought the issue Eva reports is just that gh-pages is not set up on the fork? #133 also needs settings in the glpages section of your repo to work so would not improve this.

@coretl
Copy link
Contributor

coretl commented May 23, 2023

The error in the logs is 403 when trying to push to the gh-pages of the fork. Given that https://github.com/evalott100/event-model/tree/gh-pages exists, I take this to mean it doesn't have permission...

@gilesknap
Copy link
Contributor

hmmm. Mr. peaceiris himself claims that this does work using secrets.GITHUB_TOKEN peaceiris/actions-gh-pages#153 (comment)

But I tried it and first it failed to create the gh-pages branch, I manually added that, set the pages option up on that branch and then got the same as Eva:

Push the commit or tag
  /usr/bin/git push origin gh-pages
  remote: Permission to gilesknap/python3-pip-skeleton-cli.git denied to github-actions[bot].
  fatal: unable to access 'https://github.com/gilesknap/python3-pip-skeleton-cli.git/': The requested URL returned error: 403
  Error: Action failed with "The process '/usr/bin/git' failed with exit code 128"

Perhaps this has changed since March 2020?

@coretl
Copy link
Contributor

coretl commented May 25, 2023

Is this worth an issue on the actions-gh-pages repo?

@coretl
Copy link
Contributor

coretl commented Aug 2, 2023

Should skip publishing to gh-pages for a fork

@coretl
Copy link
Contributor

coretl commented Aug 2, 2023

If origin org is different from the fork org then skip publishing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

3 participants