Reconcile
reconcile controls how gh-infra manages each file entry in the target repository. There are three modes:
| Mode | Creates | Updates | Deletes orphans |
|---|---|---|---|
patch (default) | Yes | Yes | No |
mirror | Yes | Yes | Yes |
create_only | Yes | No | No |
patch (default)
Section titled “patch (default)”Manages the declared files without touching anything else in the target directory.
files: - path: .github/CODEOWNERS content: "* @platform-team" # reconcile: patch ← default, can be omittedWhat 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.
mirror
Section titled “mirror”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: mirrorWhat 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 aboveExample: 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
create_only
Section titled “create_only”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_onlyWhat 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.
Mixing modes
Section titled “Mixing modes”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