forked from bakeronchain/learnvault
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (35 loc) · 1.22 KB
/
preview-comment.yml
File metadata and controls
39 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
# .github/workflows/preview-comment.yml
name: Preview deployment comment
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
comment-preview-url:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Wait for Vercel preview
uses: patrickedqvist/wait-for-vercel-preview@v1.3.1
id: vercel_preview
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: Preview
max_timeout: 120
- name: Post preview URL comment
if: ${{ steps.vercel_preview.outputs.url != '' }}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🚀 **Preview deployed!**\n\n${process.env.PREVIEW_URL}\n\n> Built against Stellar Testnet`
})
env:
PREVIEW_URL: ${{ steps.vercel_preview.outputs.url }}
- name: Skip missing preview
if: ${{ steps.vercel_preview.outputs.url == '' }}
run: echo "No Vercel preview deployment found for this pull request."