Skip to content

Feat: Support Explicit File Paths Beyond .env conventions - #17

Merged
sean-dickinson merged 18 commits into
mainfrom
feat/explicit-template-output-paths
Jun 2, 2026
Merged

Feat: Support Explicit File Paths Beyond .env conventions#17
sean-dickinson merged 18 commits into
mainfrom
feat/explicit-template-output-paths

Conversation

@sean-dickinson

@sean-dickinson sean-dickinson commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What

  • Adds a new option to support other file types via an explicit file path option
  • Makes the "delete template after replacement" an explicit option rather than an implicit one

Why

  • I am using this action on a .NET project which has a different file convention for secrets. I needed to update this action to allow for this rather than assuming we always want to use a .env convention.

sean-dickinson and others added 5 commits June 2, 2026 12:57
The replacer already substitutes {TOKEN} in any text file, but the file
handling assumed the ".env.<environment> -> .env" convention: it derived
the output by stripping ".<environment>" and always deleted the template.
That can't fill a file whose environment name sits mid-name, e.g. ASP.NET
Core's appsettings.Production.json, without clobbering appsettings.json.

Add two optional, backward-compatible inputs:
  * template-file-path - literal template to read (skips the sibling convention)
  * output-file-path   - literal output to write; defaults to the template
                         (fill in place). When distinct from the template the
                         template is deleted, matching convention-mode behaviour.

environment-name still drives only the <ENV>_<TOKEN>-over-<TOKEN> precedence.
bin/replace reads the new paths from the environment and falls back to the
existing positional / ENV_FILE_PATH behaviour, so current callers and the
`ruby replacer.rb .env staging` CLI are unaffected. Adds tests covering
in-place JSON templating, distinct-output deletion, and env-specific tokens.
Bumps [minitest](https://github.com/minitest/minitest) from 6.0.2 to 6.0.6.
- [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc)
- [Commits](minitest/minitest@v6.0.2...v6.0.6)

---
updated-dependencies:
- dependency-name: minitest
  dependency-version: 6.0.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [rake](https://github.com/ruby/rake) from 13.3.1 to 13.4.2.
- [Release notes](https://github.com/ruby/rake/releases)
- [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc)
- [Commits](ruby/rake@v13.3.1...v13.4.2)

---
updated-dependencies:
- dependency-name: rake
  dependency-version: 13.4.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [standard](https://github.com/standardrb/standard) from 1.36.0 to 1.54.0.
- [Release notes](https://github.com/standardrb/standard/releases)
- [Changelog](https://github.com/standardrb/standard/blob/main/CHANGELOG.md)
- [Commits](standardrb/standard@v1.36.0...v1.54.0)

---
updated-dependencies:
- dependency-name: standard
  dependency-version: 1.54.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

This comment was marked as outdated.

sean-dickinson and others added 9 commits June 2, 2026 14:26
The replacer already substitutes {TOKEN} in any text file, but the file
handling assumed the ".env.<environment> -> .env" convention: it derived
the output by stripping ".<environment>" and always deleted the template.
That can't fill a file whose environment name sits mid-name, e.g. ASP.NET
Core's appsettings.Production.json, without clobbering appsettings.json.

Add two optional, backward-compatible inputs:
  * template-file-path - literal template to read (skips the sibling convention)
  * output-file-path   - literal output to write; defaults to the template
                         (fill in place). When distinct from the template the
                         template is deleted, matching convention-mode behaviour.

environment-name still drives only the <ENV>_<TOKEN>-over-<TOKEN> precedence.
bin/replace reads the new paths from the environment and falls back to the
existing positional / ENV_FILE_PATH behaviour, so current callers and the
`ruby replacer.rb .env staging` CLI are unaffected. Adds tests covering
in-place JSON templating, distinct-output deletion, and env-specific tokens.
@sean-dickinson sean-dickinson changed the title feat: support explicit template-file-path / output-file-path Feat: Support Explicit File Paths Beyond .env conventions Jun 2, 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

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.

Comment thread lib/replacer.rb
Comment thread README.md
sean-dickinson and others added 2 commits June 2, 2026 14:49
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sean-dickinson
sean-dickinson requested a review from ajwilder June 2, 2026 18:55
@sean-dickinson
sean-dickinson merged commit 8af1c12 into main Jun 2, 2026
1 check passed
@sean-dickinson
sean-dickinson deleted the feat/explicit-template-output-paths branch June 2, 2026 19:37
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.

3 participants