|
1 | 1 | name: Pre-commit check
|
2 | 2 |
|
3 | 3 | on:
|
| 4 | + workflow_dispatch: |
4 | 5 | pull_request:
|
5 | 6 | types: [opened, reopened, synchronize, labeled]
|
| 7 | + workflow_run: |
| 8 | + workflows: ["ESP32 Arduino CI"] |
| 9 | + types: [completed] |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: pre-commit-${{github.event.pull_request.number || github.ref}} |
| 13 | + cancel-in-progress: true |
6 | 14 |
|
7 | 15 | jobs:
|
| 16 | + save-workflow-id: |
| 17 | + if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }} |
| 18 | + name: Save compilation workflow ID |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + workflow_id: ${{ steps.save-workflow-id.outputs.workflow_id }} |
| 22 | + steps: |
| 23 | + - name: Save workflow ID |
| 24 | + id: save-workflow-id |
| 25 | + run: echo "workflow_id=${{ github.event.workflow_run.id }}" >> $GITHUB_OUTPUT |
8 | 26 | lint:
|
9 | 27 | # if: |
|
10 | 28 | # contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge')
|
| 29 | + needs: save-workflow-id |
11 | 30 | name: Checking if any fixes are needed
|
12 | 31 | runs-on: ubuntu-latest
|
13 | 32 | steps:
|
@@ -35,26 +54,23 @@ jobs:
|
35 | 54 | ~/.cache/pip
|
36 | 55 | key: pre-commit|${{ env.PY_HASH }}|${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml') }}
|
37 | 56 |
|
38 |
| - - name: Wait for sketches to compile |
39 |
| - |
40 |
| - with: |
41 |
| - ref: ${{ github.event.pull_request.head.sha }} |
42 |
| - repo-token: ${{ secrets.GITHUB_TOKEN }} |
43 |
| - wait-interval: 30 |
44 |
| - running-workflow-name: lint |
45 |
| - |
46 | 57 | - name: Download compilation artifacts
|
47 | 58 | uses: actions/download-artifact@v4
|
| 59 | + if: ${{ needs.save-workflow-id.outputs.workflow_id != '' }} |
48 | 60 | with:
|
49 | 61 | pattern: build-job-*
|
50 | 62 | merge-multiple: true
|
51 | 63 | path: ~/.arduino/tests/
|
| 64 | + run-id: ${{ needs.save-workflow-id.outputs.workflow_id }} |
| 65 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
52 | 66 |
|
53 | 67 | - name: Merge compile commands
|
| 68 | + if: ${{ needs.save-workflow-id.outputs.workflow_id != '' }} |
54 | 69 | run: |
|
55 | 70 | find ~/.arduino/tests/ -iname "compile_commands.json" | xargs jq -s 'map(.[])' > ~/compile_commands.json
|
56 | 71 |
|
57 | 72 | - name: Upload compile commands
|
| 73 | + if: ${{ needs.save-workflow-id.outputs.workflow_id != '' }} |
58 | 74 | uses: actions/upload-artifact@v4
|
59 | 75 | with:
|
60 | 76 | name: compile_commands
|
|
0 commit comments