Skip to content

Commit

Permalink
[CI] Separate COMMENT from main
Browse files Browse the repository at this point in the history
  • Loading branch information
bobot committed May 21, 2024
1 parent f14e9ed commit 522aef9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 23 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Comment

on:
pull_request_target:
paths:
- submissions/*.json

jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Set up the environment
uses: ./.github/actions/setup-poetry-env

- name: Compute changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
submissions/*.json
- name: Show changed files
run: |
poetry run smtcomp show --into-comment-file comment.md ${{ steps.changed-files.outputs.all_changed_files }}
- name: PR comment with file
uses: thollander/actions-comment-pull-request@v2
with:
filePath: comment.md
comment_tag: summary
20 changes: 1 addition & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ on:
push:
branches:
- main
pull_request_target:
types: [opened, synchronize, reopened]
pull_request:

jobs:
quality:
Expand All @@ -22,23 +21,6 @@ jobs:
- name: Set up the environment
uses: ./.github/actions/setup-poetry-env

- name: Compute changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
submissions/*.json
- name: Show changed files
run: |
poetry run smtcomp show --into-comment-file comment.md ${{ steps.changed-files.outputs.all_changed_files }}
- name: PR comment with file
uses: thollander/actions-comment-pull-request@v2
with:
filePath: comment.md
comment_tag: summary

- name: Run checks
run: make check

Expand Down
6 changes: 2 additions & 4 deletions smtcomp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ def read_submission(file: Path) -> defs.Submission:
console.print("</details>")

if into_comment_file is not None:
if len(l) > 0:
into_comment_file.write_text(console.export_text())
else:
into_comment_file.write_text("")
into_comment_file.write_text(console.export_text())


@app.command()
def validate(file: str) -> None:
Expand Down

0 comments on commit 522aef9

Please sign in to comment.