Skip to content

Commit aabedec

Browse files
Add GitHub action definition
1 parent 3047969 commit aabedec

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "Doc Previewer"
2+
description: "Publish a preview of the documentation in a GitHub repository artifact"
3+
inputs:
4+
server:
5+
description: "URL of the server where the preview will be published"
6+
required: true
7+
job:
8+
description: "Name of the GitHub actions job where the artifact will be uploaded"
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: "Call Doc Previewer Webhook"
14+
shell: bash
15+
env:
16+
PREVIEWER_URL: "${{ inputs.server }}/preview/${{ github.repository }}/${{ github.event.issue.number }}?job=${{ inputs.job }}"
17+
ADD_COMMENT_URL: "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
run: |
20+
PREVIEWER_RESPONSE=$(curl -X POST ${PREVIEWER_URL})
21+
if [[ $? ]]; then
22+
curl -H "Authorization: token ${GITHUB_TOKEN}" \
23+
-d '{"body": "${PREVIEWER_RESPONSE}"}' \
24+
${ADD_COMMENT_URL}
25+
else
26+
echo $PREVIEWER_RESPONSE
27+
fi

0 commit comments

Comments
 (0)