doxygen-github-pages-action
doxygen-github-pages-action copied to clipboard
Permission to denied error when deploying
Hi, thanks for developing and maintaining this tool.
I am trying to use it for a repository that I contribute to. So far, my effort has been unsuccessful. I am getting an
remote: Permission to SlicerDMRI/SlicerDMRI.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/SlicerDMRI/SlicerDMRI.git/': The requested URL returned error: 403
error at the moment where the deployment should take place: https://github.com/SlicerDMRI/SlicerDMRI/actions/runs/6685911043/job/18164701923?pr=195#step:2:787
I have granted write permissions to the workflow, actions do have write permissions in the repository settings, and the GitHub pages Build and deployment is configured to deploy from the gh-pages branch; I have also tried setting it to GitHub Actions with the same result.
What am I missing?
Thanks.
It seems like a default settings change with new repositories.
I think the read and write permissions configured at Settings > Actions > General at the bottom should allow it to work.
Another solution suggested at https://github.com/JamesIves/github-pages-deploy-action?tab=readme-ov-file#getting-started-airplane is to add this to the workflow:
permissions:
contents: write
Looks like it could go between the on: and jobs: sections.
Let me know if this helps, if so it maybe that could be added to the readme example.
Thanks for the quick reply. I had already tried both suggestions to no avail.
It may be because the workflow is being run in a different repository, default GitHub tokens created for workflows in forks may have limited permissions, though I'm not sure what can be done about that. I've only tested this as an "on push to main" workflow and as far as I can tell it is still working for that.
If I figure anything out, I'll let you know
Maybe not an ideal solution, but I suppose one way to test the workflow is by pushing it to the main/master branch of a fork.
It may be because the workflow is being run in a different repository, default GitHub tokens created for workflows in forks may have limited permissions, though I'm not sure what can be done about that.
OK. Sounds a reasonable explanation. As you are using the action https://github.com/JamesIves/github-pages-deploy-action/discussions/, maybe I can ask there to see if they have more insight? There are some related discussions there, all suggesting what you proposed, but as said, I had already tried those.
I've only tested this as an "on push to main" workflow and as far as I can tell it is still working for that.
I initially had that configuration, but was willing to know whether the workflow would work prior to merging the branch into main.
If I figure anything out, I'll let you know
Thanks. Although I know deploying from a branch/fork is not the desired behavior for a user, ideally, a maintainer (and a user) would like to see whether a given fix or enhancement to the documentation is working as expected prior to merging the branch that contains the fix or enhancement. I ignore whether this can be done.
As you are using the action JamesIves/github-pages-deploy-action/discussions, maybe I can ask there to see if they have more insight?
Yeah, the action is a composite of 5 steps and the last step uses https://github.com/JamesIves/github-pages-deploy-action to push to the repository which is where it is failing. The doxygen-github-pages-action steps are listed in the readme and all in action.yml if you want to see how it works.
Maybe not an ideal solution, but I suppose one way to test the workflow is by pushing it to the main/master branch of a fork.
May look into that. Thanks for suggesting.
Yeah, the action is a composite of 5 steps and the last step uses https://github.com/JamesIves/github-pages-deploy-action to push to the repository which is where it is failing
Will post the question in the discussions in there, see what they say. Will report back if something relevant is said. Thanks.
May look into that. Thanks for suggesting.
Did not work: it showed the README page.
The gh-pages branch contained the right content, with the index.html being the landing page for the Doxygen documentation: https://github.com/jhlegarreta/SlicerDMRI/tree/gh-pages
In the Settings of my fork, GitHub Pages/Build and deployment I had tried both options GitHub Actions and Deploy from a Branch (the branch being gh-pages) with the same result.
Just for the sake of trying it, I later created directly in GitHub another GHA workflow file this time using:
on:
push:
branches:
- main
in the workflow file (using main was an oversight on my side -the repository uses master; I presume the deployment took place as I manually run the action), and it got deployed correctly (with poor documentation from the package for unrelated reasons):
So it looks there is some issue with the action being used from a fork or the events triggering the action.