mattnotmitt / doxygen-action

GitHub Action for generating Doxygen documentation for your projects.
MIT License
102 stars 38 forks source link

Permissions problem when running github actions #34

Closed MarkRivers closed 1 year ago

MarkRivers commented 1 year ago

I have used this project to build my Doxygen documentation on Github.

This is my .yml file: https://github.com/epics-modules/asyn/blob/master/.github/workflows/publish-docs.yml

The Doxygen documentation builds fine. The source is docs/Doxyfile which specifies that the built HTML output goes in docs/doxygenHTML. This is a listing of the docs directory after the build:

-rw-r--r-- 1 runner docker 110785 Mar  8 20:17 Doxyfile
-rw-r--r-- 1 runner docker    329 Mar  8 20:17 Makefile
drwxr-xr-x 2 root   root    12288 Mar  8 20:17 doxygenHTML
-rw-r--r-- 1 runner docker     87 Mar  8 20:17 requirements.txt
drwxr-xr-x 3 runner docker   4096 Mar  8 20:17 source

This is the beginning of the listing of the doxygenHTML directory after the build.

-rw-r--r-- 1 root root   9466 Mar  8 20:17 annotated.html
-rw-r--r-- 1 root root   9125 Mar  8 20:17 asyn_param_type_8h.html
-rw-r--r-- 1 root root  14818 Mar  8 20:17 asyn_param_type_8h_source.html
-rw-r--r-- 1 root root   2923 Mar  8 20:17 asyn_port_client_8cpp.html
-rw-r--r-- 1 root root  14779 Mar  8 20:17 asyn_port_client_8h.html
-rw-r--r-- 1 root root 175441 Mar  8 20:17 asyn_port_client_8h_source.html
-rw-r--r-- 1 root root  1[181](https://github.com/epics-modules/asyn/actions/runs/4368175027/jobs/7640418498#step:8:182)1 Mar  8 20:17 asyn_port_driver_8cpp.html

The file are all there. However, note that they are owned by root, with only read permissions for other users.

The next part of my Github actions is to build Sphinx documentation which is in docs/source.

The github actions then fails when it tries to delete the Doxygen files.

Run sphinx-notes/pages@v2
Started: bash /home/runner/work/_actions/sphinx-notes/pages/v2/main.sh
 Initialize various paths
 Installing Sphinx
 Installing requirements
 Creating temp directory
 Running Sphinx builder
 Setting up git repository
  Setting up git configure
  No local changes to save
  Setting up branch gh-pages
  Branch exists, checkout to it
  Switched to a new branch 'gh-pages'
  branch 'gh-pages' set up to track 'origin/gh-pages'.
  warning: failed to remove docs/doxygenHTML/test_asyn_port_driver_main_[8](https://github.com/epics-modules/asyn/actions/runs/4368175027/jobs/7640418498#step:9:9)cpp.html: Permission denied
  warning: failed to remove docs/doxygenHTML/nav_fd.png: Permission denied
  warning: failed to remove docs/doxygenHTML/classtest_asyn_port_driver.html: Permission denied
  warning: failed to remove docs/doxygenHTML/folderclosed.png: Permission denied
  warning: failed to remove docs/doxygenHTML/tab_bd.png: Permission denied
...
  warning: failed to remove docs/doxygenHTML/tabs.css: Permission denied
  warning: failed to remove docs/doxygenHTML/functions_u.html: Permission denied
  warning: failed to remove docs/doxygenHTML/classasyn_float64_array_client.html: Permission denied
  Error: Invalid status code: 1
      at ChildProcess.<anonymous> (/home/runner/work/_actions/sphinx-notes/pages/v2/main.js:9:19)
      at ChildProcess.emit (events.js:314:20)
      at maybeClose (internal/child_process.js:1022:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
    code: 1
  }
  Error: Invalid status code: 1
      at ChildProcess.<anonymous> (/home/runner/work/_actions/sphinx-notes/pages/v2/main.js:9:19)
      at ChildProcess.emit (events.js:314:20)
      at maybeClose (internal/child_process.js:1022:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)

Any idea why the Sphinx job is trying to delete those files?

MarkRivers commented 1 year ago

Here is some more explanation.

I am trying to build the Web pages for my repository with Github Actions. I need to do 2 things:

Both of these work separately, but not together. If I run the Doxygen build first, it generates the output files fine. But then the Sphinx build (sphinx-notes/pages@v2) tries to delete all of the files that Doxygen generated. I have tried having the Doxygen output go into the following locations:

/docs/doxygenOutput /doxygenOutput /docs/source/_static/doxygenOutput

In all cases Doxygen works fine, but then the Sphinx build tries to delete the Doxygen files. The Sphinx build the actually fails because the doxygen generated files are owned by root. But even if it succeeded it would not work, since those files need to remain after the build.

If I run the Sphinx build first then Doxygen fails because the Sphinx build has already deleted the docs/ directory containing the Doxyfile.

Any idea solve this?

mattnotmitt commented 1 year ago

The sphinx action you're using is trying to commit its changes to gh-pages after building which means it's trying to wipe all bits of the github repository it didn't build beforehand. I'd find another one ie. sphinx-build that doesn't have that functionality, since this action is incompatible with this.

MarkRivers commented 1 year ago

Thanks very much. I have changed the action for sphinx and the problem is solved.