From d527889105088143bade34fd7a8d9cdb651726b7 Mon Sep 17 00:00:00 2001 From: Borja Gonzalez Date: Wed, 22 May 2024 16:24:04 +0200 Subject: [PATCH 1/3] create gh action --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..49d41cf --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: "Look for broken links to documentation" + +on: + pull_request: + types: [opened, synchronize] +# schedule: +# # Every day at 00:00 UTC +# - cron: '0 0 * * *' + +jobs: + run-docs-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run the docs test + run: false + + - name: Create PR if test failed + if: failure() + run: | + export PR_TITLE="Fixing broken documentation links" + export RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + export PR_BODY="Some links to the documentation are broken.\nSee: $RUN_URL" + export PR_BRANCH=fix-broken-docs-links-${{ github.run_id }} + + git switch -c $PR_BRANCH + git push -u origin $PR_BRANCH + gh pr create \ + --draft \ + --title "$PR_TITLE" \ + --body "$PR_BODY" \ + --base master \ + --head $PR_BRANCH \ + --label "bug" From d477d2ac60b6dd482f2d17c0618498e62536f63d Mon Sep 17 00:00:00 2001 From: Borja Gonzalez Date: Wed, 22 May 2024 16:42:01 +0200 Subject: [PATCH 2/3] add missing token --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 49d41cf..ef2926a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,8 @@ jobs: - name: Create PR if test failed if: failure() + env: + GH_TOKEN: ${{ github.token }} run: | export PR_TITLE="Fixing broken documentation links" export RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" From 96175c9e93565c894d8503ccb734173255bd27c6 Mon Sep 17 00:00:00 2001 From: Borja Gonzalez Date: Wed, 22 May 2024 16:47:09 +0200 Subject: [PATCH 3/3] fix PR title and body --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ef2926a..0c557d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,9 +23,9 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - export PR_TITLE="Fixing broken documentation links" + export PR_TITLE="Fix broken documentation links" export RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - export PR_BODY="Some links to the documentation are broken.\nSee: $RUN_URL" + export PR_BODY="Some links to the documentation are broken. See: $RUN_URL" export PR_BRANCH=fix-broken-docs-links-${{ github.run_id }} git switch -c $PR_BRANCH