2021-05-11 00:18:44 +06:00
|
|
|
name: PR Lint Format
|
2020-12-10 23:01:51 +06:00
|
|
|
|
|
|
|
on:
|
2021-05-11 00:18:44 +06:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- 'drivers/**'
|
|
|
|
- 'lib/arm_atsam/**'
|
|
|
|
- 'lib/lib8tion/**'
|
|
|
|
- 'lib/python/**'
|
|
|
|
- 'platforms/**'
|
|
|
|
- 'quantum/**'
|
|
|
|
- 'tests/**'
|
|
|
|
- 'tmk_core/**'
|
2020-12-10 23:01:51 +06:00
|
|
|
|
|
|
|
jobs:
|
2021-05-11 00:18:44 +06:00
|
|
|
lint:
|
2020-12-10 23:01:51 +06:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2021-08-30 05:41:56 +06:00
|
|
|
container: qmkfm/qmk_cli
|
2020-12-10 23:01:51 +06:00
|
|
|
|
|
|
|
steps:
|
2022-06-29 12:44:54 +06:00
|
|
|
- uses: actions/checkout@v3
|
2020-12-17 05:00:02 +06:00
|
|
|
with:
|
2021-05-11 00:18:44 +06:00
|
|
|
fetch-depth: 0
|
2020-12-10 23:01:51 +06:00
|
|
|
|
2022-02-23 00:24:18 +06:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
pip3 install -r requirements-dev.txt
|
|
|
|
|
2022-11-29 02:04:04 +06:00
|
|
|
- name: Get changed files
|
2021-05-11 00:18:44 +06:00
|
|
|
id: file_changes
|
2022-11-29 02:04:04 +06:00
|
|
|
uses: tj-actions/changed-files@v34
|
2020-12-10 23:01:51 +06:00
|
|
|
|
2021-11-15 05:06:22 +06:00
|
|
|
- name: Run qmk formatters
|
2021-05-11 00:18:44 +06:00
|
|
|
shell: 'bash {0}'
|
2021-02-06 18:55:50 +06:00
|
|
|
run: |
|
2022-11-29 02:04:04 +06:00
|
|
|
echo '${{ steps.file_changes.outputs.added_files}}' '${{ steps.file_changes.outputs.modified_files}}' > ~/files_changed.txt
|
2021-11-23 07:40:53 +06:00
|
|
|
qmk format-c --core-only $(< ~/files_changed.txt) || true
|
|
|
|
qmk format-python $(< ~/files_changed.txt) || true
|
|
|
|
qmk format-text $(< ~/files_changed.txt) || true
|
2021-02-06 18:55:50 +06:00
|
|
|
|
2021-11-15 05:06:22 +06:00
|
|
|
- name: Fail when formatting required
|
|
|
|
run: |
|
2021-11-21 04:45:12 +06:00
|
|
|
git diff
|
2021-11-15 05:06:22 +06:00
|
|
|
for file in $(git diff --name-only); do
|
2021-11-21 04:45:12 +06:00
|
|
|
echo "File '${file}' Requires Formatting"
|
|
|
|
echo "::error file=${file}::Requires Formatting"
|
2021-11-15 05:06:22 +06:00
|
|
|
done
|
|
|
|
test -z "$(git diff --name-only)"
|