mirror of
https://github.com/RogueMaster/Flipper-IRDB.git
synced 2025-01-30 21:31:26 +00:00
ci: split linter in two jobs (#819)
This commit is contained in:
parent
29146ed9c8
commit
1fd8181086
@ -1,4 +1,4 @@
|
|||||||
name: "🧐 Checking IR Files"
|
name: Lint Check Pull Request
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@ -11,9 +11,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Clean Script Directory
|
- name: Clean Script Directory
|
||||||
run: rm -rf fff-ir-lint
|
run: rm -rf fff-ir-lint
|
||||||
@ -30,11 +27,13 @@ jobs:
|
|||||||
files: "**/*.ir"
|
files: "**/*.ir"
|
||||||
json: true
|
json: true
|
||||||
write_output_files: true
|
write_output_files: true
|
||||||
sha: ${{ github.event.pull_request.head.sha }}
|
|
||||||
|
|
||||||
- name: Verify the contents of the .github/outputs/all_changed_files.json file
|
- name: Verify the contents of the .github/outputs/all_changed_files.json file
|
||||||
run: cat .github/outputs/all_changed_files.json
|
run: cat .github/outputs/all_changed_files.json
|
||||||
|
|
||||||
|
- name: list files
|
||||||
|
run: ls -larth .github/outputs
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
@ -47,32 +46,26 @@ jobs:
|
|||||||
- name: Verify the contents of the .github/outputs/linter_output.txt file
|
- name: Verify the contents of the .github/outputs/linter_output.txt file
|
||||||
run: cat .github/outputs/linter_output.txt
|
run: cat .github/outputs/linter_output.txt
|
||||||
|
|
||||||
- name: Find Comment from Linter
|
- name: Save PR number
|
||||||
uses: peter-evans/find-comment@v3
|
run: |
|
||||||
if: ${{ github.event.pull_request.base.repo.full_name == 'Lucaslhm/Flipper-IRDB' }} # does not work in forks
|
rm -rf pr/ || true
|
||||||
id: fc
|
mkdir -p pr/
|
||||||
with:
|
echo ${{ github.event.number }} > ./pr/NR
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
|
||||||
comment-author: 'github-actions[bot]'
|
|
||||||
body-includes: '<!-- [lint] -->'
|
|
||||||
|
|
||||||
- name: Create or update comment if linter found no errors
|
- name: Create comment body if linter found no errors
|
||||||
uses: peter-evans/create-or-update-comment@v4
|
if: ${{ steps.run-linter.outcome == 'success' }}
|
||||||
if: ${{ steps.run-linter.outcome == 'success' && github.event.pull_request.base.repo.full_name == 'Lucaslhm/Flipper-IRDB' }} # does not work in forks
|
run: |
|
||||||
with:
|
cat <<EOF > ./pr/comment_body.txt
|
||||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
<!-- [lint] -->
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
Thank you for your contribution! ❤️
|
||||||
body: |
|
|
||||||
<!-- [lint] -->
|
|
||||||
Thank you for your contribution! ❤️
|
|
||||||
|
|
||||||
**The linter found no issues. 🎉**
|
**The linter found no issues. 🎉**
|
||||||
edit-mode: replace
|
EOF
|
||||||
|
|
||||||
- name: Create comment body if linter found errors
|
- name: Create comment body if linter found errors
|
||||||
if: ${{ steps.run-linter.outcome != 'success' }}
|
if: ${{ steps.run-linter.outcome != 'success' }}
|
||||||
run: |
|
run: |
|
||||||
cat <<EOF > .github/outputs/comment_body.txt
|
cat <<EOF > ./pr/comment_body.txt
|
||||||
<!-- [lint] -->
|
<!-- [lint] -->
|
||||||
Thank you for your contribution! ❤️
|
Thank you for your contribution! ❤️
|
||||||
|
|
||||||
@ -88,14 +81,11 @@ jobs:
|
|||||||
Please address these issues and update your pull request. Once the problems are resolved, the linter will re-check your changes.
|
Please address these issues and update your pull request. Once the problems are resolved, the linter will re-check your changes.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Create or update comment if linter found errors
|
- name: Save comment body
|
||||||
uses: peter-evans/create-or-update-comment@v4
|
uses: actions/upload-artifact@v4
|
||||||
if: ${{ steps.run-linter.outcome != 'success' && github.event.pull_request.base.repo.full_name == 'Lucaslhm/Flipper-IRDB' }} # does not work in forks
|
|
||||||
with:
|
with:
|
||||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
name: pr
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
path: pr/
|
||||||
body-path: .github/outputs/comment_body.txt
|
|
||||||
edit-mode: replace
|
|
||||||
|
|
||||||
- name: Fail Pipeline if Linter Found Issues
|
- name: Fail Pipeline if Linter Found Issues
|
||||||
if: ${{ steps.run-linter.outcome == 'failure' }}
|
if: ${{ steps.run-linter.outcome == 'failure' }}
|
39
.github/workflows/pr-lint-comment.yaml
vendored
Normal file
39
.github/workflows/pr-lint-comment.yaml
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
name: Lint Comment Pull Request
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: [Lint Check Pull Request]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
comment:
|
||||||
|
name: "🐛 Comment Linter Warnings"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: >
|
||||||
|
github.event.workflow_run.event == 'pull_request'
|
||||||
|
steps:
|
||||||
|
- name: "Download artifact"
|
||||||
|
uses: dawidd6/action-download-artifact@v6
|
||||||
|
with:
|
||||||
|
run_id: ${{ github.event.workflow_run.id }}
|
||||||
|
|
||||||
|
- name: Set PR Number as Environment Variable
|
||||||
|
id: set-pr-number-output
|
||||||
|
run: echo "PR_NUMBER=$(cat ./pr/NR)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Find Comment from Linter
|
||||||
|
uses: peter-evans/find-comment@v3
|
||||||
|
id: fc
|
||||||
|
with:
|
||||||
|
issue-number: ${{ env.PR_NUMBER }}
|
||||||
|
comment-author: 'github-actions[bot]'
|
||||||
|
body-includes: '<!-- [lint] -->'
|
||||||
|
|
||||||
|
- name: Create or Update Comment
|
||||||
|
uses: peter-evans/create-or-update-comment@v4
|
||||||
|
with:
|
||||||
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||||
|
issue-number: ${{ env.PR_NUMBER }}
|
||||||
|
body-path: ./pr/comment_body.txt
|
||||||
|
edit-mode: replace
|
Loading…
x
Reference in New Issue
Block a user