langroodi / doxygenize

Minimalist GitHub Action to automatically publish Doxygen-generated code documentation to GitHub Pages
MIT License
16 stars 3 forks source link

nothing to commit lead to exit 1 #11

Closed pviscone closed 2 years ago

pviscone commented 2 years ago

If the action runs without change to the documentation, the command git commit returns "nothing to commit" and then exit 1 is executed

Assuming that the action is triggered by a push on the main branch you can reproduce the issue just by modifying a file on the main branch without changing the documentation (e.g. add a line to the README.md)

I resolved this issue by changing exit 1 to exit 0 but this will also suppress other real errors from git commit

The log of the action in case of no change to the documentation (in this case I have already modified exit 1 in exit 0 but the important fact is that if there is nothing to commit the exit command is executed):

/usr/bin/docker run --name f15540e8d2df954fc446aaf63e842b09e44a0_d458e0 --label 6f1554 --workdir /github/workspace --rm -e BUILD_TYPE -e INPUT_DOXYGENCONF -e INPUT_HTMLOUTPUT -e INPUT_GHPAGESBRANCH -e INPUT_GHPAGESDIR -e INPUT_DARKMODE -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/Cpp-Repo-Template/Cpp-Repo-Template":"/github/workspace" 6f1554:0e8d2df954fc446aaf63e842b09e44a0  "./Doxyfile" "./html" "gh-pages" "./html/" "false"
+ DOXYGENCONF=./Doxyfile
+ '[' -f ./Doxyfile ]
+ echo 'Doxygen configuration file path: ./Doxyfile'
Doxygen configuration file path: ./Doxyfile
+ HTMLOUTPUT=./html
+ GHPAGESBRANCH=gh-pages
+ GHPAGESDIR=./html/
+ DARKMODE=false
+ InstallDependencies
+ apk add doxygen git openssh graphviz ttf-freefont
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/52) Installing libgcc (10.3.1_git202[11](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:12)027-r0)
(2/52) Installing libstdc++ (10.3.1_git20211027-r0)
(3/52) Installing doxygen (1.9.2-r1)
(4/52) Installing ca-certificates (2021[12](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:13)20-r0)
(5/52) Installing brotli-libs (1.0.9-r5)
(6/52) Installing nghttp2-libs (1.46.0-r0)
(7/52) Installing libcurl (7.80.0-r1)
(8/52) Installing expat (2.4.7-r0)
(9/52) Installing pcre2 (10.39-r0)
(10/52) Installing git (2.34.2-r0)
(11/52) Installing libxau (1.0.9-r0)
(12/52) Installing libmd (1.0.3-r0)
([13](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:14)/52) Installing libbsd (0.11.3-r1)
([14](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:15)/52) Installing libxdmcp (1.1.3-r0)
([15](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:16)/52) Installing libxcb (1.14-r2)
([16](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:17)/52) Installing libx11 (1.7.2-r0)
([17](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:18)/52) Installing libxext (1.3.4-r0)
([18](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:19)/52) Installing libxrender (0.9.10-r3)
([19](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:20)/52) Installing libbz2 (1.0.8-r1)
([20](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:21)/52) Installing libpng (1.6.37-r1)
([21](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:22)/52) Installing freetype (2.11.1-r2)
([22](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:23)/52) Installing libuuid (2.37.4-r0)
([23](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:24)/52) Installing fontconfig (2.13.1-r4)
([24](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:25)/52) Installing pixman (0.40.0-r3)
([25](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:26)/52) Installing cairo (1.16.0-r5)
([26](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:27)/52) Installing libffi (3.4.2-r1)
([27](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:28)/52) Installing libintl (0.21-r0)
([28](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:29)/52) Installing libblkid (2.37.4-r0)
([29](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:30)/52) Installing libmount (2.37.4-r0)
([30](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:31)/52) Installing pcre (8.45-r1)
([31](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:32)/52) Installing glib (2.70.1-r0)
([32](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:33)/52) Installing libltdl (2.4.6-r7)
([33](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:34)/52) Installing libxft (2.3.4-r0)
([34](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:35)/52) Installing fribidi (1.0.11-r0)
([35](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:36)/52) Installing graphite2 (1.3.14-r0)
([36](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:37)/52) Installing harfbuzz (3.0.0-r2)
([37](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:38)/52) Installing pango (1.48.10-r0)
([38](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:39)/52) Installing graphviz (2.49.3-r0)
([39](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:40)/52) Installing openssh-keygen (8.8_p1-r1)
([40](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:41)/52) Installing ncurses-terminfo-base (6.3_p20211120-r0)
([41](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:42)/52) Installing ncurses-libs (6.3_p20211120-r0)
([42](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:43)/52) Installing libedit (20210910.3.1-r0)
([43](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:44)/52) Installing openssh-client-common (8.8_p1-r1)
([44](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:45)/52) Installing openssh-client-default (8.8_p1-r1)
([45](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:46)/52) Installing openssh-sftp-server (8.8_p1-r1)
([46](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:47)/52) Installing openssh-server-common (8.8_p1-r1)
([47](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:48)/52) Installing openssh-server (8.8_p1-r1)
([48](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:49)/52) Installing openssh (8.8_p1-r1)
([49](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:50)/52) Installing encodings (1.0.5-r0)
([50](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:51)/52) Installing libfontenc (1.1.4-r0)
([51](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:52)/[52](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:53)) Installing mkfontscale (1.2.1-r1)
(52/52) Installing ttf-freefont (20120503-r2)
Executing busybox-1.34.1-r5.trigger
Executing ca-certificates-20211220-r0.trigger
Executing fontconfig-2.13.1-r4.trigger
Executing graphviz-2.49.3-r0.trigger
Executing mkfontscale-1.2.1-r1.trigger
OK: 70 MiB in 66 packages
+ doxygen ./Doxyfile
warning: ignoring unsupported tag 'DOCSET_FEEDURL' at line 1370, file ./Doxyfile
warning: ignoring unsupported tag 'OBFUSCATE_EMAILS' at line 1612, file ./Doxyfile
warning: ignoring unsupported tag 'DIR_GRAPH_MAX_DEPTH' at line 2528, file ./Doxyfile
Doxygen version used: 1.9.2
Searching for include files...
Searching for example files...
Searching for files in directory /github/workspace/docs/examples
Searching for images...
Searching for files in directory /github/workspace/docs/img
Searching for dot files...
Searching for msc files...
Searching for dia files...
Searching for files to exclude
Searching INPUT for files to process...
Searching for files in directory /github/workspace/include
Reading and parsing tag files
Parsing files
Preprocessing /github/workspace/include/Sample.h...
Parsing file /github/workspace/include/Sample.h...
Building macro definition list...
Building group list...
Building directory list...
Building namespace list...
Building file list...
Building class list...
Building concept list...
Computing nesting relations for classes...
Associating documentation with classes...
Associating documentation with concepts...
Building example list...
Searching for enumerations...
Searching for documented typedefs...
Searching for members imported via using declarations...
Searching for included using directives...
Searching for documented variables...
Building interface member list...
Building member list...
Searching for friends...
Searching for documented defines...
Computing class inheritance relations...
Computing class usage relations...
Flushing cached template relations that have become invalid...
Computing class relations...
Add enum values to enums...
Searching for member function documentation...
Creating members for template instances...
Building page list...
Search for main page...
Computing page relations...
Determining the scope of groups...
Sorting lists...
Determining which enums are documented
Computing member relations...
Building full member lists recursively...
Adding members to member groups.
Computing member references...
Inheriting documentation...
Generating disk names...
Adding source references...
Adding xrefitems...
Sorting member lists...
Setting anonymous enum type...
Computing dependencies between directories...
Generating citations page...
Counting members...
Counting data structures...
Resolving user defined references...
Finding anchors and sections in the documentation...
Transferring function references...
Combining using relations...
Adding members to index pages...
Correcting members for VHDL...
Computing tooltip texts...
Generating style sheet...
Generating search indices...
Generating example documentation...
Generating file sources...
Generating code for file include/Sample.h...
Generating file documentation...
Generating page documentation...
Generating group documentation...
Generating class documentation...
Generating docs for compound Sample...
Generating concept documentation...
Generating namespace index...
Generating graph info page...
Generating directory documentation...
Generating index page...
Generating page index...
Generating module index...
Generating namespace index...
Generating namespace member index...
Generating concept index...
Generating annotated compound index...
Generating alphabetical compound index...
Generating hierarchical class index...
+ '[' -d ./html ]
+ echo 'Generated HTML documents output folder: ./html'
+ '[' false '=' true ]
+ ConfigureGitUser
+ git config --global user.name 'github-actions[bot]'
Generating member index...
Generating file index...
Generating file member index...
Generating example index...
finalizing index lists...
writing tag file...
Running plantuml with JAVA...
lookup cache used 6/65[53](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:54)6 hits=8 misses=6
finished...
Generated HTML documents output folder: ./html
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
+ git config --global --add safe.directory /github/workspace
+ GetCurrentBranch
+ git rev-parse --abbrev-ref HEAD
+ echo main
+ CURRENTBRANCH=main
+ '[' main '!=' gh-pages ]
+ MigrateChanges ./html gh-pages ./html/
+ SOURCEDIR=./html
+ DESTINATIONBRANCH=gh-pages
+ DESTINATIONDIR=./html/
+ git add --force ./html
+ git stash save ./html
Saved working directory and index state On main: ./html
+ git remote update
Fetching origin
From https://github.com/pviscone/Cpp-Repo-Template
 * [new branch]      developement -> origin/developement
 * [new branch]      gh-pages     -> origin/gh-pages
+ git checkout gh-pages
Branch 'gh-pages' set up to track remote branch 'gh-pages' from 'origin'.
Switched to a new branch 'gh-pages'
+ PrepareGitHubPagesDirectory ./html/
+ DESTINATIONDIR=./html/
+ '[' -d ./html/ ]
+ git rm -rf ./html/
rm 'html/.nojekyll'
rm 'html/_sample_8h_source.html'
rm 'html/annotated.html'
+ mkdir -p ./html/
rm 'html/bc_s.png'
+ git stash pop
rm 'html/bdwn.png'
rm 'html/class_sample-members.html'
rm 'html/class_sample.html'
rm 'html/classes.html'
rm 'html/closed.png'
rm 'html/dir_d44c64[55](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:56)9bbebec7f509842c48db8b23.html'
rm 'html/doc.png'
rm 'html/doxygen.css'
rm 'html/doxygen.svg'
rm 'html/dynsections.js'
rm 'html/files.html'
rm 'html/folderclosed.png'
rm 'html/folderopen.png'
rm 'html/functions.html'
rm 'html/functions_func.html'
rm 'html/functions_vars.html'
rm 'html/index.html'
rm 'html/jquery.js'
rm 'html/menu.js'
rm 'html/menudata.js'
rm 'html/nav_f.png'
rm 'html/nav_g.png'
rm 'html/nav_h.png'
rm 'html/open.png'
rm 'html/search/all_0.html'
rm 'html/search/all_0.js'
rm 'html/search/all_1.html'
rm 'html/search/all_1.js'
rm 'html/search/all_2.html'
rm 'html/search/all_2.js'
rm 'html/search/all_3.html'
rm 'html/search/all_3.js'
rm 'html/search/all_4.html'
rm 'html/search/all_4.js'
rm 'html/search/classes_0.html'
rm 'html/search/classes_0.js'
rm 'html/search/close.svg'
rm 'html/search/functions_0.html'
rm 'html/search/functions_0.js'
rm 'html/search/functions_1.html'
rm 'html/search/functions_1.js'
rm 'html/search/functions_2.html'
rm 'html/search/functions_2.js'
rm 'html/search/functions_3.html'
rm 'html/search/functions_3.js'
rm 'html/search/mag_sel.svg'
rm 'html/search/nomatches.html'
rm 'html/search/search.css'
rm 'html/search/search.js'
rm 'html/search/search_l.png'
rm 'html/search/search_m.png'
rm 'html/search/search_r.png'
rm 'html/search/searchdata.js'
rm 'html/search/variables_0.html'
rm 'html/search/variables_0.js'
rm 'html/splitbar.png'
rm 'html/sync_off.png'
rm 'html/sync_on.png'
rm 'html/tab_a.png'
rm 'html/tab_b.png'
rm 'html/tab_h.png'
rm 'html/tab_s.png'
rm 'html/tabs.css'
On branch gh-pages
Your branch is up to date with 'origin/gh-pages'.
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    deleted:    html/.nojekyll
Dropped refs/stash@{0} (b0cccbf67dfb2e6c[56](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:57)3[58](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:59)91667fed8f19839[59](https://github.com/pviscone/Cpp-Repo-Template/runs/6836191520?check_suite_focus=true#step:4:60)5a)
+ realpath ./html/
+ realpath ./html
+ '[' '!' /github/workspace/html -ef /github/workspace/html ]
+ DisableJekyll ./html/
+ touch ./html/.nojekyll
+ CommitChanges ./html/
+ DESTINATIONDIR=./html/
+ git reset
+ git add --force ./html/
+ git commit -m 'Auto commit'
On branch gh-pages
Your branch is up to date with 'origin/gh-pages'.
nothing to commit, working tree clean
+ exit 0
langroodi commented 2 years ago

Thanks @pviscone for the report. Now I know what is actually wrong. It is because of commit 3561c1a509bc53ac3bd032430b89d610dd44f02f . You can solve this by checking if there is anything to commit or not using git diff beforehand.

So the code will be like this:

if git diff --cached --exit-code; then
   # Perform git commit
   # Then perform git push
fi

You can modify the PR you've made based on this logic (or any other similar logic that you think is better) and test if it will work or not. Then I will accept the PR and release a new patch ;) . Don't hesitate to contact me if you need help meanwhile.

langroodi commented 2 years ago

The issue has been fixed via #10 PR.