Skip to content

Reconcile

reconcile controls how gh-infra manages each file entry in the target repository. There are three modes:

ModeCreatesUpdatesDeletes orphans
patch (default)YesYesNo
mirrorYesYesYes
create_onlyYesNoNo

Manages the declared files without touching anything else in the target directory.

files:
- path: .github/CODEOWNERS
content: "* @platform-team"
# reconcile: patch ← default, can be omitted

What happens:

  • File doesn’t exist → created
  • File exists, content matches → no action
  • File exists, content differs → overwritten with the declared content

Use this for config files, security policies, or any file where you want gh-infra to keep it up to date but leave other files in the same directory alone.

Makes the target directory an exact copy of the source. Any file in the target that is not in the source is deleted.

files:
- path: .github/workflows
source: ./templates/workflows/
reconcile: mirror

What happens:

  • File in source, not in target → created
  • File in source, content differs → overwritten
  • File in target, not in source → deleted
  • File in source, content matches → no action

Mirror only affects the directory specified by path. Files outside that directory are never touched:

files:
- path: .github/workflows
source: ./templates/workflows/
reconcile: mirror
# ↑ only deletes orphans inside .github/workflows/
- path: README.md
content: "# My Project"
# ↑ unaffected by the mirror above

Example: source has ci.yml and release.yml. Target repo also has repo-dedicated.yml:

  • Directory.github/workflows/ (after apply)
    • ci.yml ← synced
    • release.yml ← synced
    • repo-dedicated.yml deleted

Creates the file once. If it already exists, gh-infra ignores it completely — no update, no comparison.

files:
- path: VERSION
content: "0.1.0"
reconcile: create_only

What happens:

  • File doesn’t exist → created
  • File exists (any content) → no action

Use this for seed files that repositories manage independently after creation: VERSION, README.md, .env.example, etc.

Different files can use different modes in the same manifest:

files:
- path: .github/workflows
source: ./templates/workflows/
reconcile: mirror
- path: .github/CODEOWNERS
content: "* @platform-team"
# reconcile: patch (default)
- path: README.md
source: ./templates/README.md.tmpl
reconcile: create_only