-
Notifications
You must be signed in to change notification settings - Fork 18
75 lines (63 loc) · 2.08 KB
/
PR.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# This workflow runs when a PR is requested
name: Pull Request Flow
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths: ['src/**', 'data/**', '.github/workflows/PR.yml', 'package.json', 'pnpm.lock']
# Ensures that only one deploy task per branch/environment will run at a time.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
if: github.event.pull_request.draft == false
env:
fork_pr: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-latest
steps:
- name: Checkout D2AI
uses: actions/checkout@v4
with:
submodules: recursive
- uses: pnpm/action-setup@v2
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile --prefer-offline
- name: Compile Typescript
run: pnpm build
- name: Get D2 Manifest
uses: nick-fields/[email protected]
with:
timeout_minutes: 2
max_attempts: 3
command: pnpm manifest:get
env:
API_KEY: ${{ secrets.API_KEY }}
- name: Generate Data
run: pnpm generate-data
- name: porcelain check
uses: dorny/paths-filter@v2
id: data
with:
base: HEAD
filters: |
changed:
- '**'
- name: Commit other updated values
if: steps.data.outputs.changed == 'true' && !env.fork_pr
uses: stefanzweifel/[email protected]
with:
commit_message: other updates from manifest
commit_user_name: D2AI Bot
commit_user_email: [email protected]
commit_author: D2AI Bot <[email protected]>
- name: Fail the Build w/ Note
if: steps.data.outputs.changed == 'true' && env.fork_pr
uses: actions/[email protected]
with:
script: |
core.setFailed('Please run `pnpm generate-data`')