Repository navigation
96 lines (81 loc) · 3.42 KB
/
Copy pathlint.yml
File metadata and controls
96 lines (81 loc) · 3.42 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
94
95
96
name: Lint
# Authoritative lint, type-check, and format checks. These back required
# status checks, so there is no paths filter on pull_request: a filtered-out
# run never reports, leaving the check at "Expected" forever.
on:
pull_request:
push:
branches:
- develop
# These jobs back required status checks and the rulesets carry a merge-queue
# rule. A check that only runs on pull_request is never reported for a queued
# batch, so the requirement would sit unsatisfied and block the queue.
merge_group:
branches:
- develop
- main
permissions:
contents: read
concurrency:
group: lint-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint (JS/YAML/package.json)
runs-on: ubuntu-latest
timeout-minutes: 10
env:
# validate:workflow-npm-scripts diffs this range; without it the base
# ref cannot be resolved from a shallow checkout and the guard would
# silently report nothing to check. fetch-depth: 0 supplies the history.
BASE_SHA: ${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event.merge_group.head_sha || github.event.pull_request.head.sha || github.sha }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts --prefer-offline --no-audit --no-fund
- name: Lint JS, YAML and package.json
# lint:ci is the uncached variant: a fresh checkout has no warm
# .eslintcache, so caching here only costs write time.
run: npm run lint:ci
# Catches the failure mode this repository has hit repeatedly: a changed
# workflow step invoking an npm script package.json does not declare,
# which then fails every run with "Missing script" until noticed.
- name: Validate workflow npm script references
run: npm run validate:workflow-npm-scripts
typecheck:
name: Typecheck
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts --prefer-offline --no-audit --no-fund
- name: Typecheck
run: npm run typecheck
# Astro component checking: `tsc` cannot read .astro files, so a type error in a
# page's markup or inline script passes the step above. The website has 36
# existing findings, so this reports them without failing the job; make it
# blocking by deleting `continue-on-error` once they are cleared.
- name: Install website dependencies
run: npm ci --prefix website --ignore-scripts --prefer-offline --no-audit --no-fund
- name: Astro check (informational)
continue-on-error: true
run: npm run typecheck:astro