-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (63 loc) · 2.06 KB
/
lean4-ci.yml
File metadata and controls
68 lines (63 loc) · 2.06 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
name: Lean4 specs
on:
pull_request:
paths:
- "specs/**"
- "lakefile.lean"
- "lean-toolchain"
- ".github/workflows/lean4-ci.yml"
push:
branches: [main, master]
paths:
- "specs/**"
- "lakefile.lean"
- "lean-toolchain"
jobs:
lean4-specs:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build specs (lake via lean-action)
uses: leanprover/lean-action@v1
with:
auto-config: "true"
test: "false"
- name: Comment on PR with build summary
if: github.event_name == 'pull_request' && success()
uses: actions/github-script@v7
with:
script: |
const body = [
'## Lean4 build',
'',
'`lake build` completed successfully for this change.',
'',
`Workflow: ${context.workflow} run [\`${context.runId}\`](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`
].join('\n');
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
const marker = '<!-- specsync-lean4-ci -->';
const existing = comments.find(c => c.body && c.body.includes(marker));
const fullBody = marker + '\n' + body;
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body: fullBody
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: fullBody
});
}