1
0
Fork 0
forked from forks/qmk_firmware
qmk_firmware/.github/workflows/format.yml

53 lines
1.2 KiB
YAML
Raw Normal View History

name: PR Lint Format
permissions:
contents: read
on:
pull_request:
paths:
- 'drivers/**'
- 'lib/arm_atsam/**'
- 'lib/lib8tion/**'
- 'lib/python/**'
- 'platforms/**'
- 'quantum/**'
- 'tests/**'
- 'tmk_core/**'
jobs:
lint:
runs-on: ubuntu-latest
container: qmkfm/qmk_cli
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: |
pip3 install -r requirements-dev.txt
2022-11-28 21:04:04 +01:00
- name: Get changed files
id: file_changes
uses: tj-actions/changed-files@v35
- name: Run qmk formatters
shell: 'bash {0}'
run: |
2022-11-28 21:04:04 +01:00
echo '${{ steps.file_changes.outputs.added_files}}' '${{ steps.file_changes.outputs.modified_files}}' > ~/files_changed.txt
qmk format-c --core-only $(< ~/files_changed.txt) || true
qmk format-python $(< ~/files_changed.txt) || true
qmk format-text $(< ~/files_changed.txt) || true
- name: Fail when formatting required
run: |
git diff
for file in $(git diff --name-only); do
echo "File '${file}' Requires Formatting"
echo "::error file=${file}::Requires Formatting"
done
test -z "$(git diff --name-only)"