-
Notifications
You must be signed in to change notification settings - Fork 51
60 lines (52 loc) · 1.3 KB
/
pr-check.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: PR Build and Sync Check
permissions:
contents: read
pull-requests: write
on:
pull_request:
branches:
- preview
types:
- opened
- synchronize
- reopened
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to check'
required: false
workflow_run:
workflows: ["Preview Branch Update"]
types:
- completed
jobs:
build-and-check:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.17.0'
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build
run: bun run build
- name: Check sync with preview
run: |
git fetch origin preview
BASE_SHA=$(git merge-base origin/preview HEAD)
PREVIEW_SHA=$(git rev-parse origin/preview)
if [ "$BASE_SHA" != "$PREVIEW_SHA" ]; then
echo "❌ Branch is not up to date with preview"
exit 1
else
echo "✅ Branch is up to date with preview"
fi