diff options
Diffstat (limited to '.github/workflows/format.yaml')
-rw-r--r-- | .github/workflows/format.yaml | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 201f3c230..6d13e7894 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml | |||
@@ -1,47 +1,42 @@ | |||
1 | name: Format Codebase | 1 | name: PR Lint Format |
2 | 2 | ||
3 | on: | 3 | on: |
4 | push: | 4 | pull_request: |
5 | branches: | 5 | paths: |
6 | - master | 6 | - 'drivers/**' |
7 | - develop | 7 | - 'lib/arm_atsam/**' |
8 | - 'lib/lib8tion/**' | ||
9 | - 'lib/python/**' | ||
10 | - 'platforms/**' | ||
11 | - 'quantum/**' | ||
12 | - 'tests/**' | ||
13 | - 'tmk_core/**' | ||
8 | 14 | ||
9 | jobs: | 15 | jobs: |
10 | format: | 16 | lint: |
11 | runs-on: ubuntu-latest | 17 | runs-on: ubuntu-latest |
12 | container: qmkfm/base_container | ||
13 | 18 | ||
14 | # protect against those who develop with their fork on master | 19 | container: qmkfm/base_container |
15 | if: github.repository == 'qmk/qmk_firmware' | ||
16 | 20 | ||
17 | steps: | 21 | steps: |
18 | - uses: rlespinasse/github-slug-action@v3.x | 22 | - uses: rlespinasse/github-slug-action@v3.x |
19 | 23 | ||
20 | - uses: actions/checkout@v2 | 24 | - uses: actions/checkout@v2 |
21 | with: | 25 | with: |
22 | token: ${{ secrets.API_TOKEN_GITHUB }} | 26 | fetch-depth: 0 |
23 | |||
24 | - name: Install dependencies | ||
25 | run: | | ||
26 | apt-get update && apt-get install -y dos2unix | ||
27 | 27 | ||
28 | - name: Format files | 28 | - uses: trilom/file-changes-action@v1.2.4 |
29 | run: | | 29 | id: file_changes |
30 | bin/qmk cformat -a | 30 | with: |
31 | bin/qmk pyformat | 31 | output: ' ' |
32 | bin/qmk fileformat | 32 | fileOutput: ' ' |
33 | 33 | ||
34 | - name: Become QMK Bot | 34 | - name: Run qmk cformat and qmk pyformat |
35 | shell: 'bash {0}' | ||
35 | run: | | 36 | run: | |
36 | git config user.name 'QMK Bot' | 37 | qmk cformat -n $(< ~/files.txt) |
37 | git config user.email 'hello@qmk.fm' | 38 | cformat_exit=$? |
39 | qmk pyformat -n | ||
40 | pyformat_exit=$? | ||
38 | 41 | ||
39 | - name: Create Pull Request | 42 | exit $((cformat_exit + pyformat_exit)) |
40 | uses: peter-evans/create-pull-request@v3 | ||
41 | with: | ||
42 | delete-branch: true | ||
43 | branch: bugfix/format_${{ env.GITHUB_REF_SLUG }} | ||
44 | author: QMK Bot <hello@qmk.fm> | ||
45 | committer: QMK Bot <hello@qmk.fm> | ||
46 | commit-message: Format code according to conventions | ||
47 | title: '[CI] Format code according to conventions' | ||