From c58690e48096790ee707d71a6c32fd1c1bf98c0a Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Wed, 20 Nov 2024 15:32:05 +0530 Subject: [PATCH 1/6] Use normal push --- .github/workflows/doxygen.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index d06766dd..91ed9f4b 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.merged == true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: persist-credentials: false fetch-depth: 0 @@ -30,8 +30,5 @@ jobs: git config --local user.name "github-actions[bot]" git commit -m "Auto-generate Doxygen documentation via Github Actions" -a - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages - force: true + run: | + git push origin gh-pages From 5427836ba5f227c8f49f51d206af68030fa3b9e8 Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Wed, 20 Nov 2024 15:49:18 +0530 Subject: [PATCH 2/6] use gh pages --- .github/workflows/doxygen.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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: | From ef4b9c90d1beac9e3d5cd8003be0ef5526364604 Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Wed, 20 Nov 2024 15:52:31 +0530 Subject: [PATCH 3/6] use gh pages --- .github/workflows/doxygen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index ad50c296..283ad10f 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -22,8 +22,6 @@ jobs: # 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" @@ -42,6 +40,8 @@ jobs: git add . - name: Commit files run: | + git config --global user.name ${{ github.actor }} + git config --global user.email ${{ github.actor }}@users.noreply.github.com git commit -m "Auto-generate Doxygen documentation via Github Actions" -a - name: Push changes run: | From 20647f51902d733069f05293d31fbd35025c23b9 Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Wed, 20 Nov 2024 15:57:35 +0530 Subject: [PATCH 4/6] use gh pages --- .github/workflows/doxygen.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 283ad10f..b835d940 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -42,7 +42,12 @@ jobs: run: | git config --global user.name ${{ github.actor }} git config --global user.email ${{ github.actor }}@users.noreply.github.com - git commit -m "Auto-generate Doxygen documentation via Github Actions" -a + git add . + # Only commit if doxygen is changed. + changed=$(git diff-index HEAD) + if [ -n "$changed" ]; then + git commit -m "Auto-generate Doxygen documentation via Github Actions" -a + fi - name: Push changes run: | git push origin gh-pages From 3ef6f2f4c954e26a9ec3ae4fbb1ebfd71b0c9e5d Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Wed, 20 Nov 2024 16:03:10 +0530 Subject: [PATCH 5/6] use gh pages --- .github/workflows/doxygen.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index b835d940..f5b8c528 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -17,6 +17,8 @@ jobs: persist-credentials: false fetch-depth: 0 - name: Switch to gh-pages branch + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash run: | # Check if the gh-pages branch exists. If not, create it. @@ -49,5 +51,7 @@ jobs: git commit -m "Auto-generate Doxygen documentation via Github Actions" -a fi - name: Push changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git push origin gh-pages From cf726473e42656d5bf0ddd8a8de12b066630012b Mon Sep 17 00:00:00 2001 From: tony-josi-aws Date: Wed, 20 Nov 2024 16:06:35 +0530 Subject: [PATCH 6/6] use gh pages --- .github/workflows/doxygen.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index f5b8c528..b75c33fe 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -40,7 +40,9 @@ jobs: cp -r ./html/* ./ rm -rf ./html git add . - - name: Commit files + - name: Commit and push files + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git config --global user.name ${{ github.actor }} git config --global user.email ${{ github.actor }}@users.noreply.github.com @@ -49,9 +51,5 @@ jobs: changed=$(git diff-index HEAD) if [ -n "$changed" ]; then git commit -m "Auto-generate Doxygen documentation via Github Actions" -a + git push origin gh-pages fi - - name: Push changes - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git push origin gh-pages