Skip to content

Commit 2a6500d

Browse files
schrocknclaude
andcommitted
Use workflow_dispatch to trigger CI instead of empty commits (#1406)
Push events from GITHUB_TOKEN don't trigger workflows, so we use explicit gh workflow run calls instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6f642f5 commit 2a6500d

File tree

3 files changed

+27
-41
lines changed

3 files changed

+27
-41
lines changed

.github/workflows/dispatch-erk-queue-git.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,14 @@ jobs:
434434
- name: Trigger CI workflows
435435
if: steps.implement.outputs.implementation_success == 'true'
436436
env:
437+
GH_TOKEN: ${{ github.token }}
437438
BRANCH_NAME: ${{ steps.branch_name.outputs.branch_name }}
438439
run: |
439-
# Push empty commit to trigger CI
440-
git commit --allow-empty -m "Trigger CI workflows"
441-
git push origin "$BRANCH_NAME"
442-
echo "✅ CI workflows triggered"
440+
# Trigger CI workflows explicitly (push events from GITHUB_TOKEN don't trigger workflows)
441+
gh workflow run test.yml --ref "$BRANCH_NAME"
442+
gh workflow run lint.yml --ref "$BRANCH_NAME"
443+
gh workflow run pyright.yml --ref "$BRANCH_NAME"
444+
gh workflow run prettier.yml --ref "$BRANCH_NAME"
445+
gh workflow run check-sync.yml --ref "$BRANCH_NAME"
446+
gh workflow run md-check.yml --ref "$BRANCH_NAME"
447+
echo "✅ CI workflows triggered via workflow_dispatch"

.github/workflows/dispatch-erk-queue-single-job.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,14 @@ jobs:
452452
- name: Trigger CI workflows
453453
if: steps.implement.outputs.implementation_success == 'true'
454454
env:
455+
GH_TOKEN: ${{ github.token }}
455456
BRANCH_NAME: ${{ steps.branch_name.outputs.branch_name }}
456457
run: |
457-
# Push empty commit to trigger CI
458-
git commit --allow-empty -m "Trigger CI workflows"
459-
git push origin "$BRANCH_NAME"
460-
echo "✅ CI workflows triggered"
458+
# Trigger CI workflows explicitly (push events from GITHUB_TOKEN don't trigger workflows)
459+
gh workflow run test.yml --ref "$BRANCH_NAME"
460+
gh workflow run lint.yml --ref "$BRANCH_NAME"
461+
gh workflow run pyright.yml --ref "$BRANCH_NAME"
462+
gh workflow run prettier.yml --ref "$BRANCH_NAME"
463+
gh workflow run check-sync.yml --ref "$BRANCH_NAME"
464+
gh workflow run md-check.yml --ref "$BRANCH_NAME"
465+
echo "✅ CI workflows triggered via workflow_dispatch"

.github/workflows/dispatch-erk-queue.yml

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -616,38 +616,14 @@ jobs:
616616
- name: Trigger CI workflows
617617
if: steps.implement.outputs.implementation_success == 'true'
618618
env:
619+
GH_TOKEN: ${{ github.token }}
619620
BRANCH_NAME: ${{ needs.setup.outputs.branch_name }}
620621
run: |
621-
echo "Triggering CI workflows for branch $BRANCH_NAME..."
622-
623-
# Fetch remote branch state
624-
git fetch origin "$BRANCH_NAME"
625-
626-
# Check divergence: both ahead AND behind means branches diverged
627-
AHEAD=$(git rev-list --count "origin/$BRANCH_NAME..$BRANCH_NAME" 2>/dev/null || echo "0")
628-
BEHIND=$(git rev-list --count "$BRANCH_NAME..origin/$BRANCH_NAME" 2>/dev/null || echo "0")
629-
630-
echo "Local vs remote: ahead=$AHEAD, behind=$BEHIND"
631-
632-
if [ "$AHEAD" -gt 0 ] && [ "$BEHIND" -gt 0 ]; then
633-
# Branches have diverged - reset local to match remote
634-
echo "⚠️ Branches have diverged (ahead=$AHEAD, behind=$BEHIND)"
635-
echo "Resetting local to match remote..."
636-
git reset --hard "origin/$BRANCH_NAME"
637-
elif [ "$AHEAD" -gt 0 ]; then
638-
# Local has unpushed commits (from failed submission) - push them
639-
echo "⚠️ Local branch is ahead by $AHEAD commit(s)"
640-
echo "This usually means /gt:pr-submit failed after creating commits"
641-
echo "Pushing pending commits before triggering CI..."
642-
git push origin "$BRANCH_NAME"
643-
elif [ "$BEHIND" -gt 0 ]; then
644-
# Local is behind remote - fast-forward to remote
645-
echo "Local branch is behind by $BEHIND commit(s), fast-forwarding..."
646-
git merge --ff-only "origin/$BRANCH_NAME"
647-
fi
648-
649-
# Push empty commit to trigger CI via synchronize event
650-
git commit --allow-empty -m "Trigger CI workflows"
651-
git push origin "$BRANCH_NAME"
652-
653-
echo "✅ CI workflows triggered via synchronize event"
622+
# Trigger CI workflows explicitly (push events from GITHUB_TOKEN don't trigger workflows)
623+
gh workflow run test.yml --ref "$BRANCH_NAME"
624+
gh workflow run lint.yml --ref "$BRANCH_NAME"
625+
gh workflow run pyright.yml --ref "$BRANCH_NAME"
626+
gh workflow run prettier.yml --ref "$BRANCH_NAME"
627+
gh workflow run check-sync.yml --ref "$BRANCH_NAME"
628+
gh workflow run md-check.yml --ref "$BRANCH_NAME"
629+
echo "✅ CI workflows triggered via workflow_dispatch"

0 commit comments

Comments
 (0)