|
4 | 4 | pull_request: |
5 | 5 | types: [opened, reopened, synchronize, labeled] |
6 | 6 |
|
| 7 | +concurrency: |
| 8 | + group: pre-commit-${{github.event.pull_request.number || github.ref}} |
| 9 | + cancel-in-progress: true |
| 10 | + |
7 | 11 | jobs: |
8 | 12 | lint: |
9 | | - if: | |
10 | | - contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') |
11 | | - name: Checking if any fixes are needed |
| 13 | + #if: ${{ contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') }} |
| 14 | + name: Run pre-commit hooks |
12 | 15 | runs-on: ubuntu-latest |
13 | 16 | steps: |
14 | 17 | - name: Checkout latest commit |
|
35 | 38 | ~/.cache/pip |
36 | 39 | key: pre-commit|${{ env.PY_HASH }}|${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml') }} |
37 | 40 |
|
| 41 | + - name: Install apt dependencies |
| 42 | + uses: awalsh128/cache-apt-pkgs-action@latest |
| 43 | + with: |
| 44 | + packages: cppcheck |
| 45 | + version: 1.0 |
| 46 | + |
38 | 47 | - name: Install python dependencies |
39 | 48 | run: python -m pip install pre-commit docutils |
40 | 49 |
|
| 50 | + # - name: Wait on other jobs to finish |
| 51 | + # uses: lucasssvaz/wait-on-workflow@v1 |
| 52 | + # id: wait-on-jobs |
| 53 | + # continue-on-error: true |
| 54 | + # with: |
| 55 | + # workflow: push.yml |
| 56 | + # max-wait: 5 |
| 57 | + # interval: 30 |
| 58 | + # timeout: 120 |
| 59 | + # sha: ${{ github.event.pull_request.head.sha || github.sha }} |
| 60 | + |
| 61 | + - name: Download compilation artifacts |
| 62 | + uses: actions/download-artifact@v4 |
| 63 | + # if: ${{ steps.wait-on-jobs.outputs.run-id != '' }} |
| 64 | + with: |
| 65 | + pattern: build-job-* |
| 66 | + merge-multiple: true |
| 67 | + path: ~/.arduino/tests/ |
| 68 | + # run-id: ${{ steps.wait-on-jobs.outputs.run-id }} |
| 69 | + run-id: 8674717774 |
| 70 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + |
| 72 | + - name: Merge compile commands |
| 73 | + # if: ${{ steps.wait-on-jobs.outputs.run-id != '' }} |
| 74 | + run: | |
| 75 | + find ~/.arduino/tests/ -iname "compile_commands.json" | xargs jq -s 'map(.[])' > ~/compile_commands.json |
| 76 | +
|
| 77 | + - name: Upload compile commands |
| 78 | + # if: ${{ steps.wait-on-jobs.outputs.run-id != '' }} |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: compile_commands |
| 82 | + path: ~/compile_commands.json |
| 83 | + |
41 | 84 | - name: Get changed files |
42 | 85 | id: changed-files |
43 | 86 | uses: tj-actions/[email protected] |
|
58 | 101 | - name: Push changes using pre-commit-ci-lite |
59 | 102 | uses: pre-commit-ci/[email protected] |
60 | 103 | if: always() |
| 104 | + with: |
| 105 | + msg: "ci(pre-commit): Apply automatic fixes" |
0 commit comments