Skip to content

Commit 89e54a8

Browse files
hyperpolymathclaude
andcommitted
fix: make instant-sync succeed when FARM_DISPATCH_TOKEN is absent
Move the secret check from a job-level `if:` condition (which GitHub marks as a workflow failure when the secret is empty) into a step-level check that outputs a flag. The dispatch and confirm steps are gated behind the flag so the workflow succeeds as a no-op when the token is not configured — mirror.yml handles direct SSH mirroring independently. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 19ba29d commit 89e54a8

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/instant-sync.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# Instant Forge Sync - Triggers propagation to all forges on push/release
3+
#
4+
# This workflow dispatches to .git-private-farm for centralised propagation.
5+
# If FARM_DISPATCH_TOKEN is not configured, the workflow succeeds as a no-op
6+
# (mirror.yml handles direct SSH mirroring independently).
37
name: Instant Sync
48

59
on:
@@ -14,9 +18,19 @@ permissions:
1418
jobs:
1519
dispatch:
1620
runs-on: ubuntu-latest
17-
if: ${{ secrets.FARM_DISPATCH_TOKEN != '' }}
1821
steps:
22+
- name: Check dispatch token
23+
id: check
24+
run: |
25+
if [ -n "${{ secrets.FARM_DISPATCH_TOKEN }}" ]; then
26+
echo "has_token=true" >> "$GITHUB_OUTPUT"
27+
else
28+
echo "has_token=false" >> "$GITHUB_OUTPUT"
29+
echo "::notice::FARM_DISPATCH_TOKEN not set — skipping farm dispatch (mirror.yml handles sync)"
30+
fi
31+
1932
- name: Trigger Propagation
33+
if: steps.check.outputs.has_token == 'true'
2034
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v3
2135
with:
2236
token: ${{ secrets.FARM_DISPATCH_TOKEN }}
@@ -31,4 +45,5 @@ jobs:
3145
}
3246
3347
- name: Confirm
48+
if: steps.check.outputs.has_token == 'true'
3449
run: echo "::notice::Propagation triggered for ${{ github.event.repository.name }}"

0 commit comments

Comments
 (0)