]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
doc: Support to retrigger docs/readthedocs.org:ceph PR build 61938/head
authorDavid Galloway <david.galloway@ibm.com>
Thu, 20 Feb 2025 15:07:08 +0000 (10:07 -0500)
committerDavid Galloway <david.galloway@ibm.com>
Fri, 21 Feb 2025 15:32:02 +0000 (10:32 -0500)
Signed-off-by: David Galloway <david.galloway@ibm.com>
.github/workflows/retrigger-rtd.yml [new file with mode: 0644]

diff --git a/.github/workflows/retrigger-rtd.yml b/.github/workflows/retrigger-rtd.yml
new file mode 100644 (file)
index 0000000..8751089
--- /dev/null
@@ -0,0 +1,42 @@
+name: Retrigger Read the Docs Build
+
+on:
+  issue_comment:
+    types: [created]
+
+permissions:
+  contents: read
+  issues: read
+  pull-requests: read
+
+jobs:
+  retrigger-rtd:
+    if: github.event.issue.pull_request &&
+        (contains(github.event.comment.body, 'jenkins test docs') || 
+         contains(github.event.comment.body, 'jenkins rebuild docs') || 
+         contains(github.event.comment.body, 'jenkins retrigger docs'))
+    runs-on: ubuntu-latest
+    steps:
+      - name: Extract PR Branch Name
+        run: |
+          PR_URL="${{ github.event.issue.pull_request.url }}"
+          PR_BRANCH=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${PR_URL}" | jq -r .head.ref)
+          echo "PR_BRANCH=${PR_BRANCH}" >> $GITHUB_ENV
+          echo "Detected PR Branch: ${PR_BRANCH}"
+
+      - name: Send Webhook to Read the Docs
+        run: |
+          PAYLOAD=$(jq -n \
+            --arg ref "refs/heads/${{ env.PR_BRANCH }}" \
+            --arg repo "${{ github.event.repository.name }}" \
+            --arg owner "${{ github.repository_owner }}" \
+            '{event: "push", ref: $ref, repository: {name: $repo, owner: {login: $owner}}}')
+
+          SECRET="${{ secrets.READTHEDOCS_API_TOKEN }}"
+          SIGNATURE=$(echo -n "$PAYLOAD" | openssl dgst -sha256 -hmac "$SECRET" | awk '{print $2}')
+
+          curl -X POST \
+            -H "Content-Type: application/json" \
+            -H "X-Hub-Signature-256: sha256=$SIGNATURE" \
+            -d "$PAYLOAD" \
+            ${{ secrets.READTHEDOCS_WEBHOOK_URL }}