2022-12-20 19:00:34 +00:00
|
|
|
name: "🧐 Checking IR Files"
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request_target:
|
|
|
|
paths: '**.ir'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
|
|
|
name: "🐛 Looking for issues"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
# checkout IRDB
|
2023-07-12 11:38:25 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 19:00:34 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
# checkout Linter
|
|
|
|
- name: Clean Script Directory
|
|
|
|
run: rm -rf fff-ir-lint
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: 'darmiel/fff-ir-lint'
|
|
|
|
path: fff-ir-lint
|
2023-08-19 20:31:02 +00:00
|
|
|
ref: 'feat/name-check'
|
2022-12-20 19:00:34 +00:00
|
|
|
|
|
|
|
# only check files changed in the PR
|
|
|
|
- name: Get Changed Files
|
|
|
|
id: changed-files
|
2023-07-12 11:40:55 +00:00
|
|
|
uses: tj-actions/changed-files@v37.1.1
|
2022-12-20 19:00:34 +00:00
|
|
|
with:
|
|
|
|
files: "**/*.ir"
|
|
|
|
separator: "\n"
|
|
|
|
sha: ${{ github.event.pull_request.head.sha }}
|
|
|
|
|
|
|
|
- name: Save changed file names to file
|
|
|
|
run: echo '${{ steps.changed-files.outputs.all_changed_files }}' > changed_file_list.txt
|
|
|
|
|
|
|
|
- uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.10'
|
|
|
|
|
|
|
|
- name: Run Linter if at least 1 IR File Changed
|
2023-07-12 11:40:55 +00:00
|
|
|
uses: mathiasvr/command-output@v2.0.0
|
2022-12-20 19:00:34 +00:00
|
|
|
id: run
|
|
|
|
continue-on-error: true
|
|
|
|
with:
|
2023-08-19 20:31:02 +00:00
|
|
|
run: 'LINTER_CONFIG=.fff-ir-lint.json python fff-ir-lint/main.py github2 file:changed_file_list.txt'
|
2022-12-20 19:00:34 +00:00
|
|
|
|
|
|
|
- uses: ntsd/auto-request-changes-action@v2
|
|
|
|
name: "Request Changes"
|
|
|
|
if: ${{ steps.run.outputs.stderr }}
|
|
|
|
with:
|
|
|
|
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
comment-body: |
|
2022-12-21 00:06:49 +00:00
|
|
|
<details>
|
|
|
|
<summary>🐛 Linter Result</summary>
|
|
|
|
|
|
|
|
${{ steps.run.outputs.stdout }}
|
|
|
|
|
|
|
|
</details>
|
2022-12-20 19:00:34 +00:00
|
|
|
|
2023-02-25 17:11:37 +00:00
|
|
|
- name: Fail Pipeline
|
|
|
|
if: ${{ steps.run.outputs.stderr }}
|
|
|
|
run: exit 1
|