Skip to content

feat(config): add CONFIG_REF environment variable for scheduled syncs#1020

Open
tdabasinskas wants to merge 2 commits into
github-community-projects:main-enterprisefrom
datolabs-io:feat/config-ref
Open

feat(config): add CONFIG_REF environment variable for scheduled syncs#1020
tdabasinskas wants to merge 2 commits into
github-community-projects:main-enterprisefrom
datolabs-io:feat/config-ref

Conversation

@tdabasinskas

Copy link
Copy Markdown

Closes #1019.

Adds a CONFIG_REF environment variable. When set, syncInstallation (the path behind CRON schedules and full-sync.js) passes it as the ref for config loading, so settings.yml and the suborg/repo configs are read from that ref of the admin repo. When unset, nothing changes: the ref stays undefined and config loading falls back to the default branch exactly as before.

Combined with FULL_SYNC_NOP=true (#733) this makes it possible to dry-run a proposed config branch in CI before merging it to the admin repo's default branch, which is what several people in #818 were trying to do.

Webhook flows are untouched; the variable is only read in the syncInstallation path.

Allow scheduled and full syncs to read configuration from a specific git ref instead of the default branch. This enables testing configuration changes from a branch before merging.

Webhook-triggered syncs continue to use the ref from the triggering event and are not affected by this setting.

The CONFIG_REF value is passed through to syncAll() and used when fetching configuration files from the admin repository.
Copilot AI review requested due to automatic review settings July 11, 2026 10:09
@tdabasinskas tdabasinskas changed the title feat(config): add CONFIG_REF environment variable for scheduled syncs feat(config): add CONFIG_REF environment variable for scheduled syncs Jul 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for running scheduled/CLI full syncs against a specific git ref of the admin repo by introducing a CONFIG_REF environment variable, addressing the limitation described in #1019 (enabling dry-run validation of config branches without merging).

Changes:

  • Add CONFIG_REF to environment configuration and pass it through the syncInstallation (CRON/full-sync) path.
  • Ensure config loading (via ConfigManager) and sync execution (Settings.syncAll) can be pinned to the provided ref.
  • Add unit coverage for syncInstallation behavior with/without CONFIG_REF, and document the new variable in the README.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
index.js Threads env.CONFIG_REF into the scheduled/CLI sync path so config reads can target a non-default admin-repo ref.
lib/env.js Exposes CONFIG_REF from process env for use by the app.
test/unit/index.syncInstallation.test.js Adds unit tests verifying default-branch behavior vs explicit CONFIG_REF behavior.
README.md Documents CONFIG_REF for scheduled/full sync configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Improve readability and clarity of the CONFIG_REF documentation by:
- Simplifying the sentence structure
- Removing redundant "admin repo" reference (already clear from context)
- Replacing "For e.g." with the grammatically correct "For example"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

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.

Full sync always reads configs from the default branch of the admin repo

2 participants