-
Notifications
You must be signed in to change notification settings - Fork 10
40 lines (35 loc) · 1.22 KB
/
preview.yml
File metadata and controls
40 lines (35 loc) · 1.22 KB
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
32
33
34
35
36
37
38
39
40
name: PR Preview Links
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [opened]
jobs:
preview-comment:
runs-on: ubuntu-latest
steps:
- name: Encode branch name
id: encode-branch
env:
BRANCH_NAME: ${{ github.head_ref }}
run: |
encoded=$(printf '%s' "$$BRANCH_NAME" | jq -sRr @uri)
echo "branch=$encoded" >> $GITHUB_OUTPUT
- name: Find existing comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "<!-- preview-links -->"
- name: Create preview comment
if: steps.find-comment.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- preview-links -->
## Preview Links
- [Backend API](https://clerk.com/docs/reference/${{ steps.encode-branch.outputs.branch }}/backend-api)
- [Frontend API](https://clerk.com/docs/reference/${{ steps.encode-branch.outputs.branch }}/frontend-api)