diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 91ed9f4b..ad50c296 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -16,6 +16,22 @@ jobs: with: persist-credentials: false fetch-depth: 0 + - name: Switch to gh-pages branch + shell: bash + run: | + # Check if the gh-pages branch exists. If not, create it. + branch_exist=$(git ls-remote --heads origin gh-pages) + if [ -z ${branch_exist} ]; then + git config --global user.name ${{ github.actor }} + git config --global user.email ${{ github.actor }}@users.noreply.github.com + git checkout --orphan gh-pages + git reset --hard + git commit --allow-empty -m "Created gh-pages branch" + git push origin gh-pages + fi + # Switch to gh-pages branch + git fetch + git checkout gh-pages - name: Create local changes run: | sudo apt-get install doxygen @@ -26,8 +42,6 @@ jobs: git add . - name: Commit files run: | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" git commit -m "Auto-generate Doxygen documentation via Github Actions" -a - name: Push changes run: |