2020-06-20 23:19:56 +02:00
|
|
|
name: PR Lint keyboards
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- 'keyboards/**'
|
|
|
|
|
|
|
|
jobs:
|
2020-11-07 18:56:08 +01:00
|
|
|
lint:
|
2020-06-20 23:19:56 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2021-08-30 01:41:56 +02:00
|
|
|
container: qmkfm/qmk_cli
|
2020-06-20 23:19:56 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2020-09-05 15:37:25 +02:00
|
|
|
- uses: trilom/file-changes-action@v1.2.4
|
2020-08-17 11:12:45 +02:00
|
|
|
id: file_changes
|
|
|
|
with:
|
|
|
|
output: '\n'
|
|
|
|
|
2020-06-20 23:19:56 +02:00
|
|
|
- name: Print info
|
|
|
|
run: |
|
|
|
|
git rev-parse --short HEAD
|
|
|
|
echo ${{ github.event.pull_request.base.sha }}
|
2020-08-17 11:12:45 +02:00
|
|
|
echo '${{ steps.file_changes.outputs.files}}'
|
2020-06-20 23:19:56 +02:00
|
|
|
|
2020-11-07 18:56:08 +01:00
|
|
|
- name: Run qmk lint
|
2020-06-20 23:19:56 +02:00
|
|
|
shell: 'bash {0}'
|
|
|
|
run: |
|
2020-08-17 11:12:45 +02:00
|
|
|
QMK_CHANGES=$(echo -e '${{ steps.file_changes.outputs.files}}')
|
2020-06-20 23:19:56 +02:00
|
|
|
QMK_KEYBOARDS=$(qmk list-keyboards)
|
|
|
|
|
|
|
|
exit_code=0
|
|
|
|
for KB in $QMK_KEYBOARDS; do
|
|
|
|
KEYBOARD_CHANGES=$(echo "$QMK_CHANGES" | grep -E '^(keyboards/'${KB}'/)')
|
|
|
|
if [[ -z "$KEYBOARD_CHANGES" ]]; then
|
|
|
|
# skip as no changes for this keyboard
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
KEYMAP_ONLY=$(echo "$KEYBOARD_CHANGES" | grep -cv /keymaps/)
|
|
|
|
if [[ $KEYMAP_ONLY -gt 0 ]]; then
|
|
|
|
echo "linting ${KB}"
|
|
|
|
|
2020-11-07 20:36:47 +01:00
|
|
|
qmk lint --keyboard ${KB} && qmk info -l --keyboard ${KB}
|
2020-11-10 16:21:59 +01:00
|
|
|
exit_code=$(($exit_code + $?))
|
2020-06-20 23:19:56 +02:00
|
|
|
fi
|
|
|
|
done
|
2020-11-10 16:21:59 +01:00
|
|
|
if [[ $exit_code -gt 255 ]]; then
|
|
|
|
exit 255
|
|
|
|
fi
|
2020-06-20 23:19:56 +02:00
|
|
|
exit $exit_code
|