opnsense-src/.github/workflows/style.yml
Ahmad Khalifa 5889ab4b1c github: limit paths for style workflow
Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1538
2024-12-05 17:59:51 -07:00

36 lines
1.1 KiB
YAML

name: Style Checker
# Runs my simple style(9) checker on pull requests.
on:
pull_request: # maybe pull_request_target
branches: [ main ]
types: [ opened, reopened, edited, synchronize ]
paths: [ '**.S', '**.c', '**.cc', '**.cpp', '**.h', '**.hh', '**.hpp' ]
permissions:
contents: read
jobs:
build:
name: Style Checker
runs-on: ubuntu-latest
steps:
# Unfortunately there doesn't seem to be a way to
# do this without an extra step.
- name: Get depth
run: |
echo "DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.DEPTH }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Install packages
run: |
sudo apt-get update --quiet || true
sudo apt-get -yq --no-install-suggests --no-install-recommends install perl
- name: Run checker
run: |
sha=$(git rev-parse HEAD~${{ github.event.pull_request.commits }})
tools/build/checkstyle9.pl --github ${sha}..${{ github.event.pull_request.head.sha }}