-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (33 loc) · 1.11 KB
/
pull-requests.yml
File metadata and controls
33 lines (33 loc) · 1.11 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
name: pr - nextjs
on: "pull_request"
jobs:
nextjs:
runs-on: ubuntu-latest
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: "Validate Vercel token"
run: |
if [ -z "$VERCEL_TOKEN" ]; then
echo "VERCEL_TOKEN is not set. Please add it as a GitHub secret."
exit 1
fi
- name: "Install vercel"
run: npm i -g vercel
- name: "Deploy to vercel"
id: deploy
run: |
deployment_url=$(vercel --confirm -t $VERCEL_TOKEN --scope $VERCEL_ORG_ID)
echo "DEPLOYMENT_URL=$deployment_url" >> $GITHUB_OUTPUT
echo "Deployment URL: $deployment_url"
- name: "comment deployment url"
uses: thollander/actions-comment-pull-request@v1
with:
message: "Preview url is ${{ steps.deploy.outputs.DEPLOYMENT_URL }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}