Skip to content

Commit 2eab9f2

Browse files
committed
ci: init pr.yml and merge-queue.yml workflows
These workflows will serve as top-level entry points for running GHA jobs against PRs and merge groups in the merge queue. Currently, the only required job is `lint`, which runs treefmt.
1 parent d1a00bf commit 2eab9f2

File tree

3 files changed

+90
-7
lines changed

3 files changed

+90
-7
lines changed

.github/workflows/lint.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
name: lint
22

33
on:
4-
pull_request:
5-
paths-ignore:
6-
- "**.md"
7-
- "**.svg"
8-
- ".gitignore"
9-
- "LICENSE"
10-
- "flake.lock"
4+
workflow_call:
5+
inputs:
6+
ref:
7+
required: true
8+
type: string
119

1210
permissions:
1311
contents: read
@@ -18,6 +16,9 @@ jobs:
1816
steps:
1917
- name: Checkout repository
2018
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ inputs.ref }}
21+
2122
- name: Install Nix
2223
uses: cachix/install-nix-action@v31
2324
with:

.github/workflows/merge-queue.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Merge Queue
2+
3+
on:
4+
merge_group:
5+
6+
permissions: {}
7+
8+
jobs:
9+
lint:
10+
uses: ./.github/workflows/lint.yml
11+
with:
12+
ref: ${{ github.event.merge_group.head_sha }}
13+
14+
# This job posts the "Required Status Checks" to satisfy our ruleset.
15+
required-checks:
16+
# It "needs" all the jobs that should block the Merge Queue.
17+
# Modify this list to add or remove jobs from required status checks.
18+
needs:
19+
- lint
20+
21+
name: Required checks
22+
runs-on: ubuntu-24.04-arm
23+
permissions:
24+
statuses: write
25+
steps:
26+
- uses: actions/github-script@v7
27+
with:
28+
script: |
29+
const { serverUrl, repo, runId, payload } = context
30+
await github.rest.repos.createCommitStatus({
31+
...repo,
32+
sha: payload.merge_group.head_sha,
33+
target_url: `${serverUrl}/${repo.owner}/${repo.repo}/actions/runs/${runId}`,
34+
// WARNING:
35+
// Do NOT change the context name or it will not match the ruleset.
36+
// This would prevent all PRs from merging.
37+
context: 'PR checks successful',
38+
state: 'success',
39+
})

.github/workflows/pr.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: PR
2+
3+
on:
4+
pull_request_target:
5+
6+
concurrency:
7+
group: pr-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
8+
cancel-in-progress: true
9+
10+
permissions: {}
11+
12+
jobs:
13+
lint:
14+
uses: ./.github/workflows/lint.yml
15+
with:
16+
ref: ${{ github.event.pull_request.head.sha }}
17+
18+
# This job posts the "Required Status Checks" to satisfy our ruleset.
19+
required-checks:
20+
# It "needs" all the jobs that should block merging a PR.
21+
# Modify this list to add or remove jobs from required status checks.
22+
needs:
23+
- lint
24+
25+
name: Required checks
26+
runs-on: ubuntu-24.04-arm
27+
permissions:
28+
statuses: write
29+
steps:
30+
- uses: actions/github-script@v7
31+
with:
32+
script: |
33+
const { serverUrl, repo, runId, payload } = context
34+
await github.rest.repos.createCommitStatus({
35+
...repo,
36+
sha: payload.pull_request.head.sha,
37+
target_url: `${serverUrl}/${repo.owner}/${repo.repo}/actions/runs/${runId}`,
38+
// WARNING:
39+
// Do NOT change the context name or it will not match the ruleset.
40+
// This would prevent all PRs from merging.
41+
context: 'PR checks successful',
42+
state: 'success',
43+
})

0 commit comments

Comments
 (0)