Skip to content

Commit 522aef9

Browse files
committed
[CI] Separate COMMENT from main
1 parent f14e9ed commit 522aef9

File tree

3 files changed

+41
-23
lines changed

3 files changed

+41
-23
lines changed

.github/workflows/comment.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Comment
2+
3+
on:
4+
pull_request_target:
5+
paths:
6+
- submissions/*.json
7+
8+
jobs:
9+
comment:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out
13+
uses: actions/checkout@v3
14+
15+
- uses: actions/cache@v3
16+
with:
17+
path: ~/.cache/pre-commit
18+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
19+
20+
- name: Set up the environment
21+
uses: ./.github/actions/setup-poetry-env
22+
23+
- name: Compute changed files
24+
id: changed-files
25+
uses: tj-actions/changed-files@v41
26+
with:
27+
files: |
28+
submissions/*.json
29+
30+
- name: Show changed files
31+
run: |
32+
poetry run smtcomp show --into-comment-file comment.md ${{ steps.changed-files.outputs.all_changed_files }}
33+
34+
- name: PR comment with file
35+
uses: thollander/actions-comment-pull-request@v2
36+
with:
37+
filePath: comment.md
38+
comment_tag: summary

.github/workflows/main.yml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
pull_request_target:
8-
types: [opened, synchronize, reopened]
7+
pull_request:
98

109
jobs:
1110
quality:
@@ -22,23 +21,6 @@ jobs:
2221
- name: Set up the environment
2322
uses: ./.github/actions/setup-poetry-env
2423

25-
- name: Compute changed files
26-
id: changed-files
27-
uses: tj-actions/changed-files@v41
28-
with:
29-
files: |
30-
submissions/*.json
31-
32-
- name: Show changed files
33-
run: |
34-
poetry run smtcomp show --into-comment-file comment.md ${{ steps.changed-files.outputs.all_changed_files }}
35-
36-
- name: PR comment with file
37-
uses: thollander/actions-comment-pull-request@v2
38-
with:
39-
filePath: comment.md
40-
comment_tag: summary
41-
4224
- name: Run checks
4325
run: make check
4426

smtcomp/main.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,8 @@ def read_submission(file: Path) -> defs.Submission:
6565
console.print("</details>")
6666

6767
if into_comment_file is not None:
68-
if len(l) > 0:
69-
into_comment_file.write_text(console.export_text())
70-
else:
71-
into_comment_file.write_text("")
68+
into_comment_file.write_text(console.export_text())
69+
7270

7371
@app.command()
7472
def validate(file: str) -> None:

0 commit comments

Comments
 (0)