Skip to content

Commit 1c7a9e8

Browse files
committed
Fix workflow trigger
1 parent 8fccd68 commit 1c7a9e8

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

.github/workflows/pre-commit.yml

+24-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
11
name: Pre-commit check
22

33
on:
4+
workflow_dispatch:
45
pull_request:
56
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
614

715
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
826
lint:
927
# if: |
1028
# contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge')
29+
needs: save-workflow-id
1130
name: Checking if any fixes are needed
1231
runs-on: ubuntu-latest
1332
steps:
@@ -35,26 +54,23 @@ jobs:
3554
~/.cache/pip
3655
key: pre-commit|${{ env.PY_HASH }}|${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml') }}
3756

38-
- name: Wait for sketches to compile
39-
uses: lewagon/[email protected]
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-
4657
- name: Download compilation artifacts
4758
uses: actions/download-artifact@v4
59+
if: ${{ needs.save-workflow-id.outputs.workflow_id != '' }}
4860
with:
4961
pattern: build-job-*
5062
merge-multiple: true
5163
path: ~/.arduino/tests/
64+
run-id: ${{ needs.save-workflow-id.outputs.workflow_id }}
65+
github-token: ${{ secrets.GITHUB_TOKEN }}
5266

5367
- name: Merge compile commands
68+
if: ${{ needs.save-workflow-id.outputs.workflow_id != '' }}
5469
run: |
5570
find ~/.arduino/tests/ -iname "compile_commands.json" | xargs jq -s 'map(.[])' > ~/compile_commands.json
5671
5772
- name: Upload compile commands
73+
if: ${{ needs.save-workflow-id.outputs.workflow_id != '' }}
5874
uses: actions/upload-artifact@v4
5975
with:
6076
name: compile_commands

0 commit comments

Comments
 (0)