-
Notifications
You must be signed in to change notification settings - Fork 2.9k
36 lines (32 loc) · 1.14 KB
/
style.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 }}