-
Notifications
You must be signed in to change notification settings - Fork 6
Custom Replacement file
Readme Replacer allows you to define custom placeholders to replace through a JSON file.
You can set your own JSON file by using the CUSTOM_REPLACER_FILE
option in the Workflow's with
settings.
Example:
name: Replace placeholders
on:
schedule:
- cron: '*/30 * * * *' # Activate every 30 minutes
workflow_dispatch: # Allow manual trigger
jobs:
replace:
runs-on: ubuntu-latest
name: Replace Placeholders in File.
steps:
- uses: actions/checkout@v2
- uses: Readme-Workflows/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
CUSTOM_REPLACER_FILE: './my-custom-replacer.json'
The file follows a specific format that you need to keep in mind, to avoid any errors.
In detail does the file have JSON objects/sections, which can have the following keys defined.
This is an optional setting that allows you to set a comment. This can be useful, if you have new contributed that wonder what this particular placeholder is good for.
It has no influence on the result.
This is the placeholder that the action should look for in the template Markdown file.
It can be any String you like, but it is recommended to stick with a specific placeholder pattern to avoid confusion and to stay consistent. Recommended placeholder patterns are {placeholder}
or %placeholder%
.
The value that the placeholder should be replaced with.
This can be any String you like. If the eval
option is set to true can you also set Javascript syntaxes that would then be evaluated.
This boolean option sets, if the replace
value should be evaluated before the replacement.
This can be useful if you want to set dynamically changing values, such as the current date and time (new Date().toLocaleString
)