Skip to content

Replace tokens

Actions
Replace tokens in files
v1.3
Latest
Star (62)

Tags

 (1)

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

Replace tokens is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Replace tokens in files
v1.3
Latest

Tags

 (1)

Replace tokens is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.