Skip to content

Commit

Permalink
fix: run code style reviewer on file changes (CleverRaven#62629)
Browse files Browse the repository at this point in the history
I would like to just run on relevant file changes, not run always and
skip if the previous run was successful + relevant file changes

since this is not included in the branch protection rules it doesn't
need to run on all prs, just on a few

Co-authored-by: casswedson <[email protected]>
  • Loading branch information
casswedson and casswedson authored Dec 9, 2022
1 parent 8f1fb0b commit 11419ee
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@ name: Code Style Reviewer

on:
pull_request_target:
paths:
- '**.json'
- '**.cpp'
- '**.h'
- '**.c'
pull_request:
paths:
- '**.json'
- '**.cpp'
- '**.h'
- '**.c'

jobs:
skip-duplicates:
if: ${{ github.event_name == 'pull_request_target' }}
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
paths: '[ "**.json", "**.cpp", "**.h", "**.c" ]'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
style-code:
needs: skip-duplicates
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name == 'pull_request_target' }}
if: ${{ github.event_name == 'pull_request_target' }}

runs-on: ubuntu-latest

Expand All @@ -30,8 +29,7 @@ jobs:
with:
ref: '${{ github.event.pull_request.head.sha }}'

- name: install dependencies
run: sudo apt-get install astyle
- run: sudo apt-get install astyle

- run: make astyle-fast
- run: make style-all-json-parallel
Expand Down

0 comments on commit 11419ee

Please sign in to comment.