aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/pr.yml
blob: 02794351276b00f96cfcbe3659692649f25b10e8 (plain)
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
name: PR

on:
  pull_request:
  merge_group:

permissions:
  contents: read # to fetch code (actions/checkout)

jobs:
  check-code-generation:
    runs-on: ubuntu-latest
    timeout-minutes: 10

    name: 'Check Code Generation: node-24, ubuntu-latest'
    steps:
      - name: Checkout
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          fetch-depth: 0

      - name: Install pnpm
        uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

      - name: Set node version to 24
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version: 24
          cache: 'pnpm'

      - name: Install deps
        run: pnpm install

      - name: Generate code
        id: generate
        run: |
          pnpm run generate:locales
          pnpm run generate:api-docs
          pnpm run build
          pnpm run test -u
        continue-on-error: true
        env:
          CI_PREFLIGHT: true

      - name: Check diff
        id: diff
        run: |
          git add .
          git diff --cached --name-only | sed -E 's/^(.*)$/::error file=\1,title=Diff detected::Please run `pnpm run preflight` and commit the changes./'
          git diff --cached --name-only --exit-code
        continue-on-error: true

      - name: Status
        if: ${{ steps.generate.outcome == 'failure' || steps.diff.outcome == 'failure' }}
        run: exit 1