Skip to content

ci(sync): check out the triggering ref, not dev, in the sync job - #37

Merged
c-vigo merged 1 commit into
mainfrom
bugfix/36-sync-checkout-main
Jul 14, 2026
Merged

c-vigo merged 1 commit into
mainfrom
bugfix/36-sync-checkout-main

Conversation

@c-vigo

@c-vigo c-vigo commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Unblock Sync main to dev

dev is stuck 4 commits behind main and cannot catch up: the sync workflow has
been failing on every push to main since #32.

Failing run: https://github.com/vig-os/commit-action/actions/runs/29314999211

The bug

The sync job checks out dev, then invokes a local composite action:

      - name: Checkout dev
        with:
          ref: dev                                        # ← workspace is now dev's tree
      - name: Set up devkit toolchain
        uses: ./.github/actions/setup-devkit-toolchain    # ← resolved from dev's tree

GitHub resolves uses: ./… against the checked-out workspace, not the
workflow's ref. .github/actions/ landed on main with the devkit 1.1.0 adoption
(#32) and does not exist on dev, so the step dies:

Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under
'…/.github/actions/setup-devkit-toolchain'.

resolve-toolchain and check pass because they check out the default ref
(main), where the action does exist. Only sync pins dev.

This is a bootstrap deadlock — the only thing that would carry the action onto
dev is the very sync PR this job can no longer open. It cannot self-heal.

The fix

Drop ref: dev, so the workspace is the triggering main SHA where the action is
guaranteed to exist.

Nothing downstream reads dev's working tree. Every subsequent step already
operates on remote refs or the API:

Step Operates on
Re-check if dev is still behind main git fetch origin main dev → git rev-list --count origin/main ^origin/dev
Detect merge conflicts git merge-tree --write-tree origin/dev origin/main
Create sync branch from main git checkout -b "$SYNC_BRANCH" origin/main
Existing-PR check · stale-branch cleanup · Create PR · auto-merge gh / REST API

fetch-depth: 0 and the commit-app token are unchanged, so merge-base and push
behavior are identical. The job now builds against the newer tree — the one whose
actions it actually references.

Upstream

This file is the devkit scaffold template verbatim (diff against
assets/workspace/.github/workflows/sync-main-to-dev.yml on devkit@main is
empty), so the defect ships to every scaffolded repo. The devkit's own copy has the
same pattern with ./.github/actions/setup-env — latent, one rename away from
firing.

Filed upstream as vig-os/devkit#1034. This PR is the local fix so
development can continue without waiting on a devkit release. A header comment and
a step comment mark the divergence so a future re-scaffold does not silently revert
it.

Verification

  • just precommit fully green locally (incl. yamllint --strict, check-yaml).
  • Behavioral proof is the next push to main: merging this PR itself triggers
    Sync main to dev, which should now open the chore/sync-main-to-dev-* PR that
    finally brings .github/actions/ onto dev.

Refs: #36

The sync job checked out `dev` and then invoked the local action
`./.github/actions/setup-devkit-toolchain`. GitHub resolves `uses: ./…`
against the checked-out workspace, so once `main` gained `.github/actions/`
(#32) and `dev` had not, the job failed with "Can't find 'action.yml' …
under .github/actions/setup-devkit-toolchain".

That deadlocked the sync: the PR that would carry the action onto `dev` is
the very PR this job opens, so `dev` could never catch up.

Drop `ref: dev` so the workspace is the triggering `main` SHA, where the
action is guaranteed to exist. No step needs dev's working tree — the
re-check, conflict detection, sync-branch creation and PR steps all operate
on remote refs (origin/main, origin/dev) or the GitHub API.

This file is the devkit scaffold verbatim, so the defect ships to every
scaffolded repo; filed upstream as vig-os/devkit#1034. This is the local fix
so development can continue without waiting on a devkit release.

Refs: #36
@c-vigo
c-vigo merged commit f5f25c8 into main Jul 14, 2026
9 checks passed
@c-vigo
c-vigo deleted the bugfix/36-sync-checkout-main branch July 16, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant