Skip to content

Commit be4e77c

Browse files
carlbennettclaude
andcommitted
fix: trigger docker-build workflow after GITHUB_TOKEN push from update.yml
GITHUB_TOKEN pushes do not trigger downstream workflows, so docker-build.yml never fires after update.yml commits a new version. Add a workflow_run trigger so docker-build runs after Check Update completes. A change-detection step skips the build when triggered via workflow_run but buildinfo.json was not modified, avoiding spurious builds on every hourly run. References #604 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 18a4834 commit be4e77c

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ on:
66
- master
77
paths:
88
- buildinfo.json
9-
# workaround for #526
9+
# workflow_run is used because GITHUB_TOKEN pushes from update.yml don't trigger push events
10+
workflow_run:
11+
workflows: ["Check Update"]
12+
types:
13+
- completed
14+
branches:
15+
- master
1016
workflow_dispatch:
1117

1218
jobs:
@@ -16,12 +22,25 @@ jobs:
1622

1723
- name: Checkout
1824
uses: actions/checkout@v6
25+
with:
26+
fetch-depth: 2
27+
28+
- name: Check if buildinfo.json changed
29+
id: check
30+
if: github.event_name == 'workflow_run'
31+
run: |
32+
if git diff --name-only HEAD~1 HEAD | grep -q '^buildinfo.json$'; then
33+
echo "changed=true" >> $GITHUB_OUTPUT
34+
else
35+
echo "changed=false" >> $GITHUB_OUTPUT
36+
fi
1937
2038
- name: Set up QEMU
39+
if: github.event_name != 'workflow_run' || steps.check.outputs.changed == 'true'
2140
uses: docker/setup-qemu-action@v3
2241

2342
- name: build and push all images
24-
if: ${{ env.DOCKER_USERNAME != '' && env.DOCKER_PASSWORD != '' }}
43+
if: (github.event_name != 'workflow_run' || steps.check.outputs.changed == 'true') && env.DOCKER_USERNAME != '' && env.DOCKER_PASSWORD != ''
2544
env:
2645
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
2746
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}

0 commit comments

Comments
 (0)