Skip to content

fix(ci): rebase+retry push in deploy/staging workflows to avoid fetch-first rejection - #240

Merged
elliotBraem merged 4 commits into
mainfrom
fix/auth-types-gen-export-wildcard
Aug 18, 2026
Merged

fix(ci): rebase+retry push in deploy/staging workflows to avoid fetch-first rejection#240
elliotBraem merged 4 commits into
mainfrom
fix/auth-types-gen-export-wildcard

Conversation

@elliotBraem

Copy link
Copy Markdown
Contributor

Replace the unconditional git push in Deploy and Staging workflows with a fetch + rebase + retry loop. Eliminates ! [rejected] main -> main (fetch first) failures when remote advances during the 10-20 min deploy window (Release PR merges, manual workflow_dispatch, Renovate, human commits).

Changes

  • .github/workflows/deploy.yml — live parent Deploy
  • .github/templates/workflows/deploy.yml — template for child projects
  • .github/workflows/staging.yml — live parent Staging
  • .github/templates/workflows/staging.yml — template for child projects
  • .changeset/fix-deploy-push-fetch-first.md — patch changeset

Loop semantics

  • git fetch origin $TARGET_BRANCH refreshes the remote-tracking ref
  • git rebase origin/$TARGET_BRANCH replays local commit on top of remote tip
  • Rebase conflicts fail loudly (manual intervention required)
  • git add bos.config.json + git diff --cached --quiet exits 0 if nothing to push
  • git push retried up to 5 times with 5/10/15/20/25s backoff

Not changed

  • concurrency.cancel-in-progress: false preserved — rebase fix already handles every race; existing semantics ("don't kill in-flight deploy") kept.

…pe *

The auth-types.gen generator hard-coded a 14-type re-export list from the
auth plugin's auth-export, causing TS2724 errors when the auth plugin renamed
or added types (e.g. GetOrganizationInput -> GetFullOrganizationInput, and
AuthTeam was missing entirely).

Replace the hard-coded list with 'export type * from auth-export' in all
five locations (the main generator, the init scaffold, and the test stub).
New types added to auth-export now flow through automatically. Updates the
init and test stubs with the corrected GetFullOrganizationInput name and
adds AuthTeam.

Adds a regression test that verifies the generator produces export type *
and would not reference a stale hard-coded name like GetOrganizationInput.

See NEARBuilders/nearbuilders.org#206
…ype *

Three duplicated copies of the auth-types.gen template (api-contract.ts x2,
init.ts x1) plus two hard-coded stub type lists (init.ts, typecheck-utils.ts)
are replaced with a single shared module: packages/everything-dev/src/auth-types-gen.ts.

Also removes three unused derived types (AuthActiveMember, AuthBaseSession,
AuthContractType) and all Raw* aliases from the generated content.

Adds export type * to host/src/lib/auth.ts, ui/src/lib/auth.ts, and
api/src/lib/auth.ts so new auth types propagate automatically — no manual
re-export list to maintain when upstream auth-export changes.

Deletes the flaky init.typecheck.test.ts which attempted to skip the network
fetch. init.full.test.ts already covers the full init + types:gen + typecheck
flow in CI.

See NEARBuilders/nearbuilders.org/issues/206
…-first rejection

The final push step in `Deploy` and `Staging` workflows ran unconditionally
on a local checkout from the start of the run. Any commit landing on the
target branch during the 10-20 minute deploy window (Release's auto-merged
`chore: version packages` PR, manual `workflow_dispatch`, Renovate, or
human commits) made the push non-fast-forward and Git rejected it with
`! [rejected] main -> main (fetch first)`.

Replace the push with a fetch + rebase + retry loop:
- git fetch origin $TARGET_BRANCH
- git rebase origin/$TARGET_BRANCH (clean conflicts fail loudly)
- git add bos.config.json
- exit 0 if no staged changes after rebase
- git push origin $TARGET_BRANCH, retry up to 5x with 5/10/15/20/25s backoff

Applied to both the live workflows and the templates that ship to child
projects via `bos sync`. `cancel-in-progress` left as-is to preserve the
existing 'don't kill in-flight deploy' semantics.
@elliotBraem
elliotBraem merged commit ad6c462 into main Aug 18, 2026
2 checks passed
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