File tree Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Original file line number Diff line number Diff line change 11name : " Doc Previewer"
22description : " Publish a preview of the documentation in a GitHub repository artifact"
33inputs :
4- server :
4+ previewer- server :
55 description : " URL of the server where the preview will be published"
66 required : true
7- job :
7+ artifact- job :
88 description : " Name of the GitHub actions job where the artifact will be uploaded"
99 required : true
10- token :
10+ github- token :
1111 description : " GitHub token available as the `secrets.GITHUB_TOKEN` variable"
1212 required : true
1313runs :
1414 using : " composite"
1515 steps :
1616 - name : " Call Doc Previewer Webhook"
17+ id : call-previewer
18+ shell : bash
19+ env :
20+ PREVIEWER_URL : " ${{ inputs.previewer-server }}/preview/${{ github.repository }}/${{ github.event.issue.number }}"
21+ ARTIFACT_JOB : " ${{ inputs.artifact-job }}"
22+ run : echo "previewer-response=$(curl -X POST -f --data-urlencode \"job=${JOB}\" ${PREVIEWER_URL})" >> "$GITHUB_OUTPUT"
23+ - name : " Add GitHub Comment"
1724 shell : bash
1825 env :
19- PREVIEWER_URL : " ${{ inputs.server }}/preview/${{ github.repository }}/${{ github.event.issue.number }}"
2026 ADD_COMMENT_URL : " https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"
21- GITHUB_TOKEN : " ${{ inputs.token }}"
22- ARTIFACT_JOB : " ${{ inputs.job }}"
23- run : |
24- PREVIEWER_RESPONSE=$(curl -X POST --data-urlencode "job=${JOB}" ${PREVIEWER_URL})
25- if [[ $? ]]; then
26- curl -H "Authorization: token ${GITHUB_TOKEN}" \
27- -d '{"body": "${PREVIEWER_RESPONSE}"}' \
28- ${ADD_COMMENT_URL}
29- else
30- echo $PREVIEWER_RESPONSE
31- fi
27+ AUTHORIZATION_HEADER : " Authorization: token ${{ inputs.github_token }}"
28+ PREVIEWER_RESPONSE : " ${{ steps.call-previewer.outputs.previewer-response }}"
29+ run : curl -H "${AUTHORIZATION_HEADER}" -d "{\"body\": \"${PREVIEWER_RESPONSE}\"}" ${ADD_COMMENT_URL}
You can’t perform that action at this time.
0 commit comments