-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
31 lines (31 loc) · 1.31 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: "Doc Previewer"
description: "Publish a preview of the documentation in a GitHub repository artifact"
inputs:
previewer-server:
description: "URL of the server where the preview will be published"
required: true
artifact-job:
description: "Name of the GitHub actions job where the artifact will be uploaded"
required: true
runs:
using: "composite"
steps:
- name: "Call Doc Previewer Webhook"
id: call-previewer
shell: bash
env:
PREVIEWER_URL: "${{ inputs.previewer-server }}/submit/${{ github.repository }}/${{ github.event.issue.number }}/"
ARTIFACT_JOB: ${{ inputs.artifact-job }}
run: |
PREVIEWER_RESPONSE=$(curl -X POST -f "${PREVIEWER_URL}?job=${ARTIFACT_JOB// /%20}")
EXIT_CODE=$?
echo "previewer-response=${PREVIEWER_RESPONSE}" | tee -a "$GITHUB_OUTPUT"
exit ${EXIT_CODE}
- name: "Add GitHub Comment"
shell: bash
env:
ADD_COMMENT_URL: "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"
GITHUB_TOKEN: ${{ github.token }}
PREVIEWER_RESPONSE: ${{ steps.call-previewer.outputs.previewer-response }}
run: |
curl -f -H "Authorization: Bearer ${GITHUB_TOKEN}" -d '{"body": "${{ env.PREVIEWER_RESPONSE }}"}' ${ADD_COMMENT_URL}