{"id":21471159,"url":"https://github.com/im-open/octostache-action","last_synced_at":"2026-01-29T03:12:43.057Z","repository":{"id":39877367,"uuid":"399100933","full_name":"im-open/octostache-action","owner":"im-open","description":"An action for performing Octopus variable substitution","archived":false,"fork":false,"pushed_at":"2024-10-31T20:06:12.000Z","size":59257,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T18:41:26.404Z","etag":null,"topics":["code","swat-team","variable-substitution"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/im-open.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-08-23T12:47:39.000Z","updated_at":"2024-03-27T15:54:32.000Z","dependencies_parsed_at":"2024-03-19T21:47:54.143Z","dependency_job_id":null,"html_url":"https://github.com/im-open/octostache-action","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/im-open%2Foctostache-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/im-open%2Foctostache-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/im-open%2Foctostache-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/im-open%2Foctostache-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/im-open","download_url":"https://codeload.github.com/im-open/octostache-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250320470,"owners_count":21411375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","swat-team","variable-substitution"],"created_at":"2024-11-23T09:32:09.357Z","updated_at":"2026-01-29T03:12:38.037Z","avatar_url":"https://github.com/im-open.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# octostache-action\n\nThis action will scan the file(s) provided in the `files-with-substitutions` argument for Octopus variable substitution syntax `#{VariableName}`. If the files contain any `#{Variables}` that match an item in the `variables-file` or environment variables, it will replace the template with the actual value. If a variable is found in both the `variables-file` and in the environment variables, then the environment variable value will be used.\n\nSome items to note:\n\n- This action will make modifications to any files in `files-with-substitutions` if matching Octostache templates are identified.\n- Substitutions can be defined in a `variables-file` or as environment variables.  \n  - The action will use [default GitHub environment variables] and environments variables set at the workflow, job or step level.\n- The action does not consider case when looking for Octostache templates to replace.  For example if a one of the files with substitutions contained `${launchdarkly}` and an env var was defined as `LAUNCHDARKLY`, the substitution would be made.\n\n## Index\u003c!-- omit in toc --\u003e\n\n- [octostache-action](#octostache-action)\n  - [Inputs](#inputs)\n  - [Outputs](#outputs)\n  - [Usage Examples](#usage-examples)\n    - [Variables File](#variables-file)\n    - [Environment Variables](#environment-variables)\n    - [Example Files that contain Octostache Substitution Syntax](#example-files-that-contain-octostache-substitution-syntax)\n    - [Workflow](#workflow)\n  - [Contributing](#contributing)\n    - [Incrementing the Version](#incrementing-the-version)\n    - [Source Code Changes](#source-code-changes)\n    - [Recompiling Manually](#recompiling-manually)\n    - [Updating the README.md](#updating-the-readmemd)\n  - [Code of Conduct](#code-of-conduct)\n  - [License](#license)\n\n## Inputs\n\n| Parameter                  | Is Required | Description                                                                                                                                                                                                                                  |\n|----------------------------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `variables-file`           | false       | An optional yaml file containing variables to use in the substitution.  The alternative is to define [environment variables] to use for the substitutions.                                                                                     |\n| `files-with-substitutions` | true        | A comma separated list of files or [.NET-compatible glob patterns](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.filesystemglobbing.matcher?view=dotnet-plat-ext-6.0#remarks) with `#{variables}` that need substitution. |\n\n## Outputs\n\nNo Outputs\n\n## Usage Examples\n\n### Variables File\n\nWhen using the `variables-file` argument, this is the structure of the file containing the variable names and values that will be substituted.\n\n```yaml\nEnvironment: Dev\nVersion: 1.3.62\nLaunchDarklyKey: abc\nGoogleAnalyticsKey: 123\nAppInsightsKey: a1b2c3\n```\n\n### Environment Variables\n\nIn addition to the `variables-file` argument, substitutions can be provided in the `env:` section of the action. The format matches what is supplied in the `variables-file`: `\u003cvar-name\u003e: \u003cvar-value\u003e`.\n\nIf the same item is provided in the `variables-file` and the `env:` section, the value in the `env:` section will be used.\n\n### Example Files that contain Octostache Substitution Syntax\n\nThese are some sample files that contain the Octostache substitution syntax `#{}`. These files would be included in the `files-with-substitutions` argument above.\n\n`DemoApp19.csproj`\n\n```xml\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\n  \u003cPropertyGroup\u003e\n    \u003cOutputType\u003eExe\u003c/OutputType\u003e\n    \u003cTargetFramework\u003enet5.0\u003c/TargetFramework\u003e\n    \u003cVersion\u003e#{VersionToReplace}\u003c/Version\u003e\n  \u003c/PropertyGroup\u003e\n\u003c/Project\u003e\n```\n\n`build-variables.js`\n\n```js\nconst { profiles } = require('../../Properties/launchSettings.json');\nconst { environmentTypes } = require('./constants');\n\nconst substitutionVariables = {\n  BUILD_APPINSIGHTS_INSTRUMENTATION_KEY: '#{AppInsightsKey}',\n  BUILD_GA_KEY: '#{GoogleAnalyticsKey}',\n  BUILD_LAUNCH_DARKLY_KEY: '#{LaunchDarklyKey}}'\n};\n```\n\n`index.html`\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003c!--... head items ...--\u003e\n    \u003cscript type=\"text/javascript\"\u003evar gaKey = '#{GoogleAnalyticsKey}';\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003c!--... application body ...--\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Workflow\n\n```yml\nname: Deploy\n\non:\n  workflow_dispatch:\n\njobs:\n  substitute-variables:\n    runs-on: ubuntu-20.04\n    steps:\n      - uses: actions/checkout@v3\n      \n      # You may also reference just the major or major.minor version\n      - uses: im-open/octostache-action@v4.0.3\n        with:\n          variables-file: ./substitution-variables.yml\n          files-with-substitutions: ./src/DemoApp19/DemoApp19.csproj,./src/DemoApp19/Bff/FrontEnd/scripts/build-variables.js,./src/**/*.html\n        env:\n          # Note that this value would be used over the value from the example variables file\n          LaunchDarklyKey: ${{ secrets.LAUNCH_DARKLY_API_KEY }}\n```\n\n## Contributing\n\nWhen creating PRs, please review the following guidelines:\n\n- [ ] The action code does not contain sensitive information.\n- [ ] At least one of the commit messages contains the appropriate `+semver:` keywords listed under [Incrementing the Version] for major and minor increments.\n- [ ] The action has been recompiled.  See [Recompiling Manually] for details.\n- [ ] The README.md has been updated with the latest version of the action.  See [Updating the README.md] for details.\n\n### Incrementing the Version\n\nThis repo uses [git-version-lite] in its workflows to examine commit messages to determine whether to perform a major, minor or patch increment on merge if [source code] changes have been made.  The following table provides the fragment that should be included in a commit message to active different increment strategies.\n\n| Increment Type | Commit Message Fragment                     |\n|----------------|---------------------------------------------|\n| major          | +semver:breaking                            |\n| major          | +semver:major                               |\n| minor          | +semver:feature                             |\n| minor          | +semver:minor                               |\n| patch          | *default increment type, no comment needed* |\n\n### Source Code Changes\n\nThe files and directories that are considered source code are listed in the `files-with-code` and `dirs-with-code` arguments in both the [build-and-review-pr] and [increment-version-on-merge] workflows.  \n\nIf a PR contains source code changes, the README.md should be updated with the latest action version and the action should be recompiled.  The [build-and-review-pr] workflow will ensure these steps are performed when they are required.  The workflow will provide instructions for completing these steps if the PR Author does not initially complete them.\n\nIf a PR consists solely of non-source code changes like changes to the `README.md` or workflows under `./.github/workflows`, version updates and recompiles do not need to be performed.\n\n### Recompiling Manually\n\nThis command utilizes [esbuild] to bundle the action and its dependencies into a single file located in the `dist` folder.  If changes are made to the action's [source code], the action must be recompiled by running the following command:\n\n```sh\n# Installs dependencies and bundles the code\nnpm run build\n```\n\n### Updating the README.md\n\nIf changes are made to the action's [source code], the [usage examples] section of this file should be updated with the next version of the action.  Each instance of this action should be updated.  This helps users know what the latest tag is without having to navigate to the Tags page of the repository.  See [Incrementing the Version] for details on how to determine what the next version will be or consult the first workflow run for the PR which will also calculate the next version.\n\n## Code of Conduct\n\nThis project has adopted the [im-open's Code of Conduct](https://github.com/im-open/.github/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nCopyright \u0026copy; 2024, Extend Health, LLC. Code released under the [MIT license](LICENSE).\n\n \u003c!-- Links --\u003e\n[Incrementing the Version]: #incrementing-the-version\n[Recompiling Manually]: #recompiling-manually\n[Updating the README.md]: #updating-the-readmemd\n[source code]: #source-code-changes\n[usage examples]: #usage-examples\n[build-and-review-pr]: ./.github/workflows/build-and-review-pr.yml\n[increment-version-on-merge]: ./.github/workflows/increment-version-on-merge.yml\n[esbuild]: https://esbuild.github.io/getting-started/#bundling-for-node\n[git-version-lite]: https://github.com/im-open/git-version-lite\n[default GitHub environment variables]: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables\n[environment variables]: #environment-variables\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fim-open%2Foctostache-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fim-open%2Foctostache-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fim-open%2Foctostache-action/lists"}