Repository navigation
93 lines (81 loc) · 2.83 KB
/
Copy pathlint-typescript.yml
File metadata and controls
93 lines (81 loc) · 2.83 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: lint
# Runs the repository-root `pnpm run lint` (`nx run-many -t lint`), covering the
# six TypeScript SDK packages and demo-viewer (apps/dojo).
#
# That command failed for roughly ten months and no workflow ran it, so nothing
# reported it (PNI-272). A lint target that only ever runs on a contributor's
# machine is indistinguishable from one that does not run at all, so it lives
# here now.
#
# No protoc step: unlike the `unit` workflow, linting needs no build, and
# `src/generated` is committed.
on:
push:
branches: [main]
paths:
- "sdks/typescript/**"
- "apps/**"
- "eslint.config.base.mjs"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "package.json"
- "nx.json"
- ".github/workflows/lint-typescript.yml"
pull_request:
branches: [main]
paths:
- "sdks/typescript/**"
- "apps/**"
- "eslint.config.base.mjs"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "package.json"
- "nx.json"
- ".github/workflows/lint-typescript.yml"
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Detect fork PR
id: fork-check
run: |
if [[ "$GITHUB_EVENT_NAME" == "pull_request" && \
"$PR_HEAD_REPO" != "$GITHUB_REPOSITORY" ]]; then
echo "prefix=fork-" >> "$GITHUB_OUTPUT"
else
echo "prefix=" >> "$GITHUB_OUTPUT"
fi
env:
# Passed via env rather than interpolated into the script: a fork's repo
# name is attacker-controlled text. GITHUB_EVENT_NAME and
# GITHUB_REPOSITORY are Actions built-ins, so nothing is expanded here.
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "22"
- name: Install pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 10.33.4
- name: Setup pnpm cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.local/share/pnpm/store
key: ${{ steps.fork-check.outputs.prefix }}${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ steps.fork-check.outputs.prefix }}${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run lint
run: pnpm run lint