2021-05-10 20:18:44 +02:00
|
|
|
name: PR Lint Format
|
2020-12-10 18:01:51 +01:00
|
|
|
|
|
|
|
on:
|
2021-05-10 20:18:44 +02:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- 'drivers/**'
|
|
|
|
- 'lib/arm_atsam/**'
|
|
|
|
- 'lib/lib8tion/**'
|
|
|
|
- 'lib/python/**'
|
|
|
|
- 'platforms/**'
|
|
|
|
- 'quantum/**'
|
|
|
|
- 'tests/**'
|
|
|
|
- 'tmk_core/**'
|
2020-12-10 18:01:51 +01:00
|
|
|
|
|
|
|
jobs:
|
2021-05-10 20:18:44 +02:00
|
|
|
lint:
|
2020-12-10 18:01:51 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2021-08-30 01:41:56 +02:00
|
|
|
container: qmkfm/qmk_cli
|
2020-12-10 18:01:51 +01:00
|
|
|
|
|
|
|
steps:
|
2021-11-15 00:06:22 +01:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update && apt-get install -y dos2unix
|
2021-02-14 20:51:07 +01:00
|
|
|
|
2020-12-10 18:01:51 +01:00
|
|
|
- uses: actions/checkout@v2
|
2020-12-17 00:00:02 +01:00
|
|
|
with:
|
2021-05-10 20:18:44 +02:00
|
|
|
fetch-depth: 0
|
2020-12-10 18:01:51 +01:00
|
|
|
|
2021-05-10 20:18:44 +02:00
|
|
|
- uses: trilom/file-changes-action@v1.2.4
|
|
|
|
id: file_changes
|
|
|
|
with:
|
|
|
|
output: ' '
|
|
|
|
fileOutput: ' '
|
2020-12-10 18:01:51 +01:00
|
|
|
|
2021-11-15 00:06:22 +01:00
|
|
|
- name: Run qmk formatters
|
2021-05-10 20:18:44 +02:00
|
|
|
shell: 'bash {0}'
|
2021-02-06 13:55:50 +01:00
|
|
|
run: |
|
2021-11-23 02:20:46 +01:00
|
|
|
set +e
|
2021-11-23 01:49:18 +01:00
|
|
|
cat ~/files_added.txt ~/files_modified.txt > ~/files_changed.txt
|
|
|
|
qmk format-c --core-only $(< ~/files_changed.txt)
|
|
|
|
qmk format-python $(< ~/files_changed.txt)
|
|
|
|
qmk format-text $(< ~/files_changed.txt)
|
2021-02-06 13:55:50 +01:00
|
|
|
|
2021-11-15 00:06:22 +01:00
|
|
|
- name: Fail when formatting required
|
|
|
|
run: |
|
2021-11-20 23:45:12 +01:00
|
|
|
git diff
|
2021-11-15 00:06:22 +01:00
|
|
|
for file in $(git diff --name-only); do
|
2021-11-20 23:45:12 +01:00
|
|
|
echo "File '${file}' Requires Formatting"
|
|
|
|
echo "::error file=${file}::Requires Formatting"
|
2021-11-15 00:06:22 +01:00
|
|
|
done
|
|
|
|
test -z "$(git diff --name-only)"
|