Skip to content

Commit 2d8617e

Browse files
authored
create comments on PRs with deployment preview links (#780)
1 parent cbc5e9e commit 2d8617e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/docs-preview-create.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,31 @@ jobs:
3333
git config --global user.email "github-actions[bot]@users.noreply.github.com"
3434
3535
- name: Push
36+
id: push
3637
run: git add -A && git commit -m "sync docs" && git push -u origin ${{ env.BRANCH }}
38+
39+
- name: Get preview deployment URL
40+
id: url
41+
run: echo "SLUG=$(echo ${BRANCH//\//})" >> $GITHUB_ENV
42+
43+
- name: Find comment
44+
id: fc
45+
if: steps.push.outcome == 'success'
46+
uses: peter-evans/find-comment@v3
47+
with:
48+
token: ${{ secrets.COMMENTER_TOKEN }}
49+
repository: ${{ github.event.client_payload.repo }}
50+
issue-number: ${{ github.event.client_payload.pr }}
51+
comment-author: 'github-actions[bot]'
52+
body-includes: Build output
53+
54+
- name: Create comment
55+
if: steps.fc.outputs.comment-id == ''
56+
uses: peter-evans/create-or-update-comment@v4
57+
with:
58+
token: ${{ secrets.COMMENTER_TOKEN }}
59+
repository: ${{ github.event.client_payload.repo }}
60+
issue-number: ${{ github.event.client_payload.pr }}
61+
body: |
62+
Preview deployment: https://svelte-dev-git-${{ env.SLUG }}-svelte.vercel.app/
63+
edit-mode: replace

0 commit comments

Comments
 (0)