-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (42 loc) · 1.38 KB
/
ci:precommit.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
name: ci:precommit
on:
push:
branches:
- main
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: Continuous integration (test precommit)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
# TODO Fetch sparingly with something similar to
# https://github.com/rmacklin/fetch-through-merge-base/blob/main/action.yml
# Maybe could use commit count (does not exist on merge_group
# somehow)
# Maybe setting .git/shallow to base first would work in all cases?
# See https://stackoverflow.com/a/76573878
fetch-depth: 0
- name: Compute MERGE_BASE and HEAD_SHA 📜
id: event
uses: ./.github/actions/github/event
- name: Stage MERGE_BASE...HEAD_SHA ⏮️
env:
HEAD_SHA: ${{ steps.event.outputs.head-sha }}
MERGE_BASE: ${{ steps.event.outputs.merge-base }}
run: |
git reset --hard "${HEAD_SHA}"
git reset --soft "${MERGE_BASE}"
# TODO Do something destructive to check that it is not picked up.
- name: Install 💾
uses: ./.github/actions/install
- name: Run precommit 🔬
run: |
npm run precommit