Repository navigation
84 lines (76 loc) · 3.27 KB
/
Copy pathlint.yml
File metadata and controls
84 lines (76 loc) · 3.27 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
name: Oxlint check
on:
workflow_call:
pull_request:
types: [opened, synchronize]
paths:
[
'**.js',
'**.ts',
'**.tsx',
'**.json',
'**.mjs',
'**.cjs',
'config/.editorconfig',
'oxlint.config.mts',
'config/oxlint/**',
'scripts/lint/**',
'scripts/lintChanged.sh',
'.watchmanconfig',
'.imgbotconfig',
'.github/workflows/lint.yml',
]
concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('{0}-{1}', github.ref, github.sha) || github.ref }}-lint
cancel-in-progress: true
jobs:
lint:
name: Oxlint check
if: ${{ (github.event.head_commit.author.name != 'OSBotify' || github.event_name == 'push') && (github.event_name != 'pull_request' || github.actor != 'os-botify[bot]') }}
runs-on: blacksmith-8vcpu-ubuntu-2404
steps:
- name: Checkout
uses: useblacksmith/checkout@0647fdbab2614a5eb86d2971070e325060d91056 # v1.7.0
with:
# Only use the elevated OSBotify token on the post-merge `workflow_call` run
# (so the auto-commit step below can push to the protected `main` branch).
# PR runs use the default GITHUB_TOKEN so PR code can't borrow push-to-main
# access via the persisted checkout credentials.
token: ${{ github.event_name == 'push' && secrets.OS_BOTIFY_COMMIT_TOKEN || github.token }}
- name: Setup Node
uses: ./.github/actions/composite/setupNode
with:
WORKSPACES: '["server/victory-chart-renderer", "web/cloudflare-worker"]'
# oxlint runs JS plugins on one thread (oxc#26621), so OxlintLinter splits them into 4 shards on this 8 vCPU runner.
- name: Lint JavaScript and TypeScript with Oxlint
run: npm run lint -- --shards=4
# If lint tightened the seatbelt baseline (i.e. fewer baselined errors than last time),
# commit the updated TSV back to `main` as OSBotify. Only runs under `workflow_call`
# (i.e. invoked from preDeploy.yml, which only triggers on push to main).
- name: Check for tightened oxlint-seatbelt baseline
id: seatbelt_diff
if: github.event_name == 'push'
run: |
if git diff --quiet config/oxlint/oxlint.seatbelt.tsv; then
echo "tightened=false" >> "$GITHUB_OUTPUT"
echo "::notice::oxlint.seatbelt.tsv unchanged; skipping auto-commit."
else
echo "tightened=true" >> "$GITHUB_OUTPUT"
fi
- name: Setup git for OSBotify
if: steps.seatbelt_diff.outputs.tightened == 'true'
uses: Expensify/GitHub-Actions/setupGitForOSBotify@main
with:
OP_VAULT: ${{ vars.OP_VAULT }}
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
SETUP_AS_APP: false
# If the push races with another commit to `main`, let this step fail.
# The next `push: main` lint run will re-tighten the baseline and try
# again; no need to retry here.
- name: Auto-commit tightened oxlint-seatbelt baseline
if: steps.seatbelt_diff.outputs.tightened == 'true'
continue-on-error: true
run: |
git add config/oxlint/oxlint.seatbelt.tsv
git commit -m "Auto-tighten oxlint-seatbelt baseline"
git push origin main