Repository navigation
fix: scope full sync to GH_ORG and await Probot readiness - #1095
Merged
decyjphr merged 3 commits intoSep 29, 2026
Merged
Conversation
Adapt PR #1053 source 0201457 onto yadhav/fix-recent-issues at 188c604. Preserve the first-installation default and enterprise context, and return scheduled sync promises so targeting failures are reported. Cover case-insensitive selection, fail-closed targeting, NOP and CLI failures, scheduler reporting, and explicit-org smoke dry runs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Wait for the installed Probot runtime to initialize before using its logger or loading the application. Preserve existing full-sync reporting and exit behavior. Add no-network real-runtime CLI regressions for apply and dry-run success, missing targets, and collected sync failures; update existing CLI mock fixtures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve all repository-owning installations when GH_ORG is unset and limit sync to the matching account when configured. Retain failure aggregation, Probot readiness, scheduler error reporting, and all regression and smoke coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the stated targeting and fanout behavior with comprehensive regression coverage; only a minor documentation correction remains.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Scopes full syncs using GH_ORG while preserving multi-installation fanout and ensuring Probot is ready before CLI use.
Changes:
- Adds case-insensitive installation targeting and clear failures.
- Preserves sequential fanout, enterprise enrichment, and cron error reporting.
- Expands CLI, unit, smoke, and documentation coverage.
| File | Description |
|---|---|
.env.example |
Documents GH_ORG behavior. |
README.md |
Documents scoped full sync and smoke testing. |
docs/github-action.md |
Updates GitHub Actions guidance. |
full-sync.js |
Awaits Probot readiness. |
index.js |
Implements targeting and cron rejection propagation. |
lib/env.js |
Exports GH_ORG. |
smoke-test.js |
Adds targeted CLI smoke phase. |
test/unit/full-sync.test.js |
Tests real Probot CLI startup. |
test/unit/lib/env.test.js |
Tests environment defaults and overrides. |
test/unit/lib/settings-batching.test.js |
Updates Probot readiness mock. |
test/unit/smoke-organization-targeting.test.js |
Tests smoke-phase safeguards. |
test/unit/sync-installation.test.js |
Covers targeting, fanout, and failures. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ``` | ||
| CREATE_DEFAULT_BRANCH=true | ||
| ``` | ||
| 1. Scope CLI and cron full syncs to one account using `GH_ORG`. For e.g. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why
Operators need to restrict full sync to a specific account instead of reconciling every account where the App is installed. This adapts #1053 to
yadhav/fix-recent-issues, including its now-merged all-installations behavior from #1094.Approach
GH_ORGand select the matching repository-owning account case-insensitively. Fail clearly when no installation matches, including an empty installation list, rather than falling back to another account.GH_ORGis unset, preserve the target branch's sequential sync of all repository-owning installations. Retain per-installation authentication/context, failure isolation, and aggregated{ results, errors }.info()slug lookup; enterprise installations are not repository sync targets.Validation
Node 22.12.0 / npm 10.9.0:
npm run test:unit -- --runInBand --reporters=default: 889 passed, 12 skipped.GH_ORGfanout, case-insensitive single-account targeting, enterprise exclusion, failure aggregation/isolation, targeted NOP configuration failure without fallback, CLI exit status, and cron failure reporting.Earlier live smoke, before this merge resolution: setup -> Phase 24 -> teardown passed 6 assertions with actual CLI completion and exit status verified. Independent cleanup confirmed unchanged original configuration, property definitions, admin policy, unrelated refs, and repository/team/role inventories. Owned processes exited and the port closed. No live smoke was rerun for the merge resolution.
Live coverage limitation: That smoke used a session-only verified-installation enumeration filter and hard authentication/API guards. It proves a contained single-test-org CLI/NOP run, not unfiltered live multi-account selection. Second-account selection and no-match behavior are covered offline. The first smoke attempt was rejected because Probot reloaded
.envover explicitly blank execution flags; the retry verified effective flags after loading and restored the private environment copy exactly. No containment adapters or credentials are committed.Earlier baseline validation found integration failures at the pre-existing Probot ESM import boundary (7 suites, 0 executed tests) and repository lint debt of 173 errors and 7 warnings. Those broad checks were not rerun for this merge resolution.
Provenance and integration
Originally based on
188c604929201774699fd1d8dabd445358cee9e8:020145722fb1251f53d7331ccba6bdbc56217a60from fix: sync the installation matching GH_ORG during full sync #1053 -> adaptationfd2d26e67213e280700fde3e4e983c7ad049a65f.a408d67184e44aed656303a71f11122f12e552e8.d8232afintegrates target4c5742b, including Fix repository and environment variable pagination #1093 and fix: sync all repository-owning app installations #1094.The overlap with #1044's adaptation is now reconciled: all repository-owning installations when unset, only the matching account when
GH_ORGis set. Combined local regression coverage passes; the earlier single-branch smoke is not presented as live validation of the merged implementation.