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 1
1
name : " Doc Previewer"
2
2
description : " Publish a preview of the documentation in a GitHub repository artifact"
3
3
inputs :
4
- server :
4
+ previewer- server :
5
5
description : " URL of the server where the preview will be published"
6
6
required : true
7
- job :
7
+ artifact- job :
8
8
description : " Name of the GitHub actions job where the artifact will be uploaded"
9
9
required : true
10
- token :
10
+ github- token :
11
11
description : " GitHub token available as the `secrets.GITHUB_TOKEN` variable"
12
12
required : true
13
13
runs :
14
14
using : " composite"
15
15
steps :
16
16
- 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"
17
24
shell : bash
18
25
env :
19
- PREVIEWER_URL : " ${{ inputs.server }}/preview/${{ github.repository }}/${{ github.event.issue.number }}"
20
26
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