-
Notifications
You must be signed in to change notification settings - Fork 8
65 lines (63 loc) · 1.83 KB
/
ci-per-commit.yaml
File metadata and controls
65 lines (63 loc) · 1.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
name: CI per commit
on:
push:
branches:
- main
pull_request:
types: [labeled]
branches:
- main
jobs:
check-label:
name: Check for ci:per-commit label
runs-on: ubuntu-latest
outputs:
has_label: ${{ steps.check.outputs.has_label }}
steps:
- uses: actions/checkout@v6
- name: Check for label
id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
.github/scripts/check-ci-per-commit-label.sh \
"${{ github.event_name }}" \
"${{ github.repository }}" \
"${{ github.sha }}" \
'${{ toJSON(github.event.pull_request.labels.*.name) }}' \
>> "$GITHUB_OUTPUT"
ci-per-commit:
name: CI per commit
needs: check-label
if: needs.check-label.outputs.has_label == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"
- name: Install GNU sed (macOS)
if: runner.os == 'macOS'
run: brew install gnu-sed
- name: Determine commit range
id: range
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
else
BASE="${{ github.event.before }}"
HEAD="${{ github.sha }}"
fi
echo "base=${BASE}" >> "$GITHUB_OUTPUT"
echo "head=${HEAD}" >> "$GITHUB_OUTPUT"
- name: Run CI on each commit
run: |
.github/scripts/run-ci-per-commit.sh \
"${{ steps.range.outputs.base }}" \
"${{ steps.range.outputs.head }}"