GitHub Action to replace tags in files
Processes input file by replacing tags with provided input parameters.
sourceData
Optional JSON data source file with action parameters:
[
{
"prefix": "<!--views:info:marker:start-->\n",
"suffix": "\n<!--views:info:marker:end-->",
"sourceFile": "./data/info.md",
"placeholder": "<!--views:info:marker:start-->[\\s\\S]*?<!--views:info:marker:end-->",
"replacement": "<p align=\"center\" style=\"text-align:center;\">Info data block</p>"
},
{
"prefix": "<!--views:readme:marker:start-->\n",
"suffix": "\n<!--views:readme:marker:end-->",
"sourceFile": "./data/readme.md",
"placeholder": "<!--views:readme:marker:start-->[\\s\\S]*?<!--views:readme:marker:end-->",
"replacement": "<p align=\"center\" style=\"text-align:center;\">Readme data block</p>"
},
{
"prefix": "test data\n",
"suffix": "",
"sourceFile": "./data/test.md",
"placeholder": "test data",
"replacement": "<p align=\"center\" style=\"text-align:center;\">Test data block</p>"
}
]
[
{
"sourceFile": "./data/info.md",
"placeholder": "<!--views:info:marker:start-->[\\s\\S]*?<!--views:info:marker:end-->",
"replacement": "<p align=\"center\" style=\"text-align:center;\">Info data block</p>"
},
{
"sourceFile": "./data/readme.md",
"placeholder": "<!--views:readme:marker:start-->[\\s\\S]*?<!--views:readme:marker:end-->",
"replacement": "<p align=\"center\" style=\"text-align:center;\">Readme data block</p>"
},
{
"sourceFile": "./data/test.md",
"placeholder": "test data",
"replacement": "<p align=\"center\" style=\"text-align:center;\">Test data block</p>"
}
]
prefix
Optional String data to prepend before replacement
suffix
Optional String data to append after replacement
sourceFile
Required Input source file to replace in
placeholder
Required String placeholder or regex to replace by
replacement
Required String data to replace with
changed
File processing operation status
true
When input source file successfully processed
false
When error occurred while processing input source file
- name: Replace file placeholders
uses: alexrogalskiy/github-action-tag-replacer@master
with:
prefix: '<!--views:marker:start-->\n'
suffix: '\n<!--views:marker:end-->'
sourceFile: './data/info.md'
placeholder: '<!--views:marker:start-->[\s\S]*?<!--views:marker:end-->'
replacement: '<p align="center" style="text-align:center;">Data Block</p>'
Running locally:
npm run start:action --action github-action-tag-replacer --prefix '<!--views:marker:start-->\n' --suffix '\n<!--views:marker:end-->' --sourceFile './data/info.md' --placeHolder '<!--views:marker:start-->[\s\S]*?<!--views:marker:end-->' --replacement '<p align="center" style="text-align:center;">Data Block</p>'
Tag Replacer is distributed under LGPL version 3 or later, [License]. LGPLv3 is additional permissions on top of GPLv3.
Tag Replacer is maintained by the following GitHub team-members:
with community support please contact with us if you have some question or proposition.
The project uses SemVer for versioning. For the versions available, see the tags on this repository.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us (emoji key).
This project follows the all-contributors specification. Contributions of any kind are welcome!
See also the list of contributors who participated in this project.
Like Tag Replacer ? Consider buying me a coffee :)