|
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: Wait for other jobs to finish |
| 42 | + |
| 43 | + with: |
| 44 | + ref: ${{ github.event.pull_request.head.sha || github.sha }} |
| 45 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + wait-interval: 30 |
| 47 | + check-regexp: '^Arduino [0-9]+ on ubuntu-latest$' |
| 48 | + |
| 49 | + - name: Get workflow id |
| 50 | + id: save-workflow-id |
| 51 | + run: | |
| 52 | + RUNID=$(gh api repos/${{ github.repository }}/commits/${{ github.event.pull_request.head.sha }}/check-runs | \ |
| 53 | + jq -r '.check_runs[] | \ |
| 54 | + select(.name == "Arduino 0 on ubuntu-latest") | | |
| 55 | + .html_url | \ |
| 56 | + capture("/runs/(?<number>[0-9]+)/job") | \ |
| 57 | + .number' | \ |
| 58 | + sed 's/"//g' | \ |
| 59 | + head -n 1) |
| 60 | + echo "RUNID=$RUNID" >> $GITHUB_ENV |
| 61 | + echo "Workflow id: $RUNID" |
| 62 | +
|
| 63 | + - name: Download compilation artifacts |
| 64 | + uses: actions/download-artifact@v4 |
| 65 | + if: ${{ env.RUNID != '' }} |
| 66 | + with: |
| 67 | + pattern: build-job-* |
| 68 | + merge-multiple: true |
| 69 | + path: ~/.arduino/tests/ |
| 70 | + run-id: ${{ env.RUNID }} |
| 71 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + |
| 73 | + - name: Merge compile commands |
| 74 | + if: ${{ env.RUNID != '' }} |
| 75 | + run: | |
| 76 | + find ~/.arduino/tests/ -iname "compile_commands.json" | xargs jq -s 'map(.[])' > ~/compile_commands.json |
| 77 | +
|
| 78 | + - name: Upload compile commands |
| 79 | + if: ${{ env.RUNID != '' }} |
| 80 | + uses: actions/upload-artifact@v4 |
| 81 | + with: |
| 82 | + name: compile_commands |
| 83 | + path: ~/compile_commands.json |
| 84 | + |
38 | 85 | - name: Install python dependencies
|
39 | 86 | run: python -m pip install pre-commit docutils
|
40 | 87 |
|
|
0 commit comments