MCPcopy Index your code
hub / github.com/cschleiden/replace-tokens

github.com/cschleiden/replace-tokens @v1.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.4 ↗ · + Follow
4 symbols 13 edges 4 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Replace tokens

Simple GitHub Action to replace tokens in files.

Inputs

  • files - Glob expression, file name or array of glob/file name
  • tokenPrefix - Prefix to use when matching tokens, defaults to #{
  • tokenSuffix - Suffix to use when matching tokens, defaults to }#

Example

If you want to replace #{CDN}# and #{CALLBACK}# in all of your JS files, add the action to your workflow like this:

- uses: cschleiden/replace-tokens@v1
  with:
    files: '["**/*.js"]'
  env:
    CDN: https://somecdn.com/...
    CALLBACK: some_value

If you want to use a different token format, you can specify a custom token prefix/suffix. For example, to replace just tokens like {CDN} you could add:

- uses: cschleiden/replace-tokens@v1
  with:
    tokenPrefix: '{'
    tokenSuffix: '}'
    files: '["**/*.js"]'
  env:
    CDN: https://somecdn.com/...

Acknowledgements

  • Inspired by the excellent https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens Azure Pipelines task.
  • Uses replace-in-file to do the actual replacement

Core symbols most depended-on inside this repo

replaceTokens
called by 7
src/replace.ts
escapeDelimiter
called by 4
src/replace.ts
getFiles
called by 1
src/main.ts
run
called by 1
src/main.ts

Shape

Function 4

Languages

TypeScript100%

Modules by API surface

src/replace.ts2 symbols
src/main.ts2 symbols

For agents

$ claude mcp add replace-tokens \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact