1- name : Retrigger Read the Docs Build
1+ name : Retrigger RTD build on PR comment
22
33on :
44 issue_comment :
55 types : [created]
66
77permissions :
88 contents : read
9- issues : read
109 pull-requests : read
1110
1211jobs :
@@ -16,27 +15,11 @@ jobs:
1615 contains(github.event.comment.body, 'jenkins rebuild docs') ||
1716 contains(github.event.comment.body, 'jenkins retrigger docs'))
1817 runs-on : ubuntu-latest
19- steps :
20- - name : Extract PR Branch Name
21- run : |
22- PR_URL="${{ github.event.issue.pull_request.url }}"
23- PR_BRANCH=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${PR_URL}" | jq -r .head.ref)
24- echo "PR_BRANCH=${PR_BRANCH}" >> $GITHUB_ENV
25- echo "Detected PR Branch: ${PR_BRANCH}"
2618
27- - name : Send Webhook to Read the Docs
19+ steps :
20+ - name : Trigger Read the Docs build
2821 run : |
29- PAYLOAD=$(jq -n \
30- --arg ref "refs/heads/${{ env.PR_BRANCH }}" \
31- --arg repo "${{ github.event.repository.name }}" \
32- --arg owner "${{ github.repository_owner }}" \
33- '{event: "push", ref: $ref, repository: {name: $repo, owner: {login: $owner}}}')
34-
35- SECRET="${{ secrets.READTHEDOCS_API_TOKEN }}"
36- SIGNATURE=$(echo -n "$PAYLOAD" | openssl dgst -sha256 -hmac "$SECRET" | awk '{print $2}')
37-
3822 curl -X POST \
39- -H "Content-Type: application/json" \
40- -H "X-Hub-Signature-256: sha256=$SIGNATURE" \
41- -d "$PAYLOAD" \
42- ${{ secrets.READTHEDOCS_WEBHOOK_URL }}
23+ "https://readthedocs.org/api/v3/projects/ceph/versions/${{ github.event.issue.number }}/builds/" \
24+ -H "Authorization: Token ${{ secrets.READTHEDOCS_API_TOKEN }}" \
25+ -H "Content-Type: application/json"
0 commit comments