https://github.com/alexrogalskiy/github-action-tag-replacer
🏷️ GitHub action to replace placeholders in files
https://github.com/alexrogalskiy/github-action-tag-replacer
github-actions replace-text
Last synced: 4 months ago
JSON representation
🏷️ GitHub action to replace placeholders in files
- Host: GitHub
- URL: https://github.com/alexrogalskiy/github-action-tag-replacer
- Owner: AlexRogalskiy
- License: gpl-3.0
- Created: 2021-03-20T17:35:49.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-24T07:32:17.000Z (4 months ago)
- Last Synced: 2025-01-24T08:26:25.632Z (4 months ago)
- Topics: github-actions, replace-text
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/tag-replacer
- Size: 919 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 317
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
- Support: .github/support.yml
Awesome Lists containing this project
README
# *Tag Replacer*
> GitHub Action to replace tags in files
[](https://github.com/marketplace/actions/tag-replacer)
[](https://github.com/lekterable/perfekt)
[](https://github.com/prettier/prettier)

[](https://houndci.com)
[](https://github.com/AlexRogalskiy/github-action-tag-replacer/discussions)[](https://deepsource.io/gh/AlexRogalskiy/github-action-tag-replacer/?ref=repository-badge)
[](https://deepscan.io/dashboard#view=project\&tid=11946\&pid=16314\&bid=347248)











[](https://renovatebot.com/)
[](https://dependabot.com/)
[](https://newreleases.io/github/AlexRogalskiy/github-action-tag-replacer)
[](https://hitsofcode.com/github/alexrogalskiy/github-action-tag-replacer?branch=master/view?branch=master)
[](https://david-dm.org/AlexRogalskiy/github-action-tag-replacer)
[](https://david-dm.org/AlexRogalskiy/github-action-tag-replacer?type=dev)[](https://app.codeac.io/github/AlexRogalskiy/github-action-tag-replacer)
[](https://coveralls.io/github/AlexRogalskiy/github-action-tag-replacer?branch=master)
[](https://codebeat.co/projects/github-com-alexrogalskiy-github-action-tag-replacer-master)
[](https://lgtm.com/projects/g/AlexRogalskiy/github-action-tag-replacer/alerts/)
[](https://lgtm.com/projects/g/AlexRogalskiy/github-action-tag-replacer/context:javascript)
[](https://codecov.io/gh/AlexRogalskiy/github-action-tag-replacer)
[](https://github.com/AlexRogalskiy/github-action-tag-replacer/actions/workflows/build.yml)
[](https://circleci.com/gh/AlexRogalskiy/github-action-tag-replacer)
[](https://github.com/marketplace/actions/super-linter)
[](http://commitizen.github.io/cz-cli/)
[][repo]
[![Public workflows that use this action.][total_usages]][search_results]
[![Licence][license_id]][license_content][](https://github.com/AlexRogalskiy/github-action-tag-replacer/discussions)
[](https://github.com/AlexRogalskiy/github-action-tag-replacer/labels/question)
[](https://github.com/AlexRogalskiy/github-action-tag-replacer/labels/bug)## *Table of contents*
- [*Description*](#description)
- [*Inputs*](#inputs)
- [`sourceData`](#sourcedata)
- [`prefix`](#prefix)
- [`suffix`](#suffix)
- [`sourceFile`](#sourcefile)
- [`placeholder`](#placeholder)
- [`replacement`](#replacement)
- [*Outputs*](#outputs)
- [`changed`](#changed)
- [*Examples*](#examples)
- [*Visitor stats*](#visitor-stats)
- [*Licensing*](#licensing)
- [*Authors*](#authors)
- [*Versioning*](#versioning)
- [*Contribution*](#contribution)
- [*Acknowledgement*](#acknowledgement)
- [*Forks*](#forks)
- [*Development Support*](#development-support)## *Description*
Processes input file by replacing tags with provided input parameters.
## *Inputs*
### `sourceData`
**Optional** JSON data source file with action parameters:
#### Complete parameters
```json
[
{
"prefix": "\n",
"suffix": "\n",
"sourceFile": "./data/info.md",
"placeholder": "[\\s\\S]*?",
"replacement": "Info data block
"
},
{
"prefix": "\n",
"suffix": "\n",
"sourceFile": "./data/readme.md",
"placeholder": "[\\s\\S]*?",
"replacement": "Readme data block
"
},
{
"prefix": "test data\n",
"suffix": "",
"sourceFile": "./data/test.md",
"placeholder": "test data",
"replacement": "Test data block
"
}
]
```#### Basic parameters
```json
[
{
"sourceFile": "./data/info.md",
"placeholder": "[\\s\\S]*?",
"replacement": "Info data block
"
},
{
"sourceFile": "./data/readme.md",
"placeholder": "[\\s\\S]*?",
"replacement": "Readme data block
"
},
{
"sourceFile": "./data/test.md",
"placeholder": "test data",
"replacement": "Test data block
"
}
]
```### `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
## *Outputs*
### `changed`
File processing operation status
#### `true`
When input source file successfully processed
#### `false`
When error occurred while processing input source file
## *Examples*
```yml
- name: Replace file placeholders
uses: alexrogalskiy/github-action-tag-replacer@master
with:
prefix: '\n'
suffix: '\n'
sourceFile: './data/info.md'
placeholder: '[\s\S]*?'
replacement: 'Data Block
'
```Running locally:
- `npm run start:action --action github-action-tag-replacer --prefix '\n' --suffix '\n' --sourceFile './data/info.md' --placeHolder '[\s\S]*?' --replacement '
Data Block
'`## *Visitor stats*
[](https://hits.seeyoufarm.com)


## *Licensing*
***Tag Replacer*** is distributed under LGPL version 3 or later,
\[[License](https://github.com/AlexRogalskiy/github-action-tag-replacer/blob/master/LICENSE)]. LGPLv3 is additional
permissions on top of GPLv3.
## *Authors*
***Tag Replacer*** is maintained by the following GitHub team-members:
- [](https://github.com/AlexRogalskiy)
with community support please contact with us if you have some question or proposition.
## *Versioning*
The project uses [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on
this repository][tags].## *Contribution*
[](https://badges.pufler.dev)
Please read
[CONTRIBUTING.md](https://github.com/AlexRogalskiy/github-action-tag-replacer/blob/master/.github/CONTRIBUTING.md)
for details on our code of conduct, and the process for submitting pull requests to us
([emoji key](https://allcontributors.org/docs/en/emoji-key)).This project follows the [all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind are welcome](http://makeapullrequest.com)
See also the list of [contributors][contributors] who participated in this project.
## *Acknowledgement*
[][stars]
## *Forks*
[][forkers]
## *Development Support*
Like ***Tag Replacer*** ? Consider buying me a coffee :)
[](https://www.patreon.com/alexrogalskiy)
[](https://www.buymeacoffee.com/AlexRogalskiy)
[](https://ko-fi.com/alexrogalskiy)***
[](https://www.typescriptlang.org/)
[](https://github.com/)
[](https://forthebadge.com/)[repo]: https://github.com/AlexRogalskiy/github-action-tag-replacer
[tags]: https://github.com/AlexRogalskiy/github-action-tag-replacer/tags
[issues]: https://github.com/AlexRogalskiy/github-action-tag-replacer/issues
[pulls]: https://github.com/AlexRogalskiy/github-action-tag-replacer/pulls
[wiki]: https://github.com/AlexRogalskiy/github-action-tag-replacer/wiki
[stars]: https://github.com/AlexRogalskiy/github-action-tag-replacer/stargazers
[forkers]: https://github.com/AlexRogalskiy/github-action-tag-replacer/network/members
[contributors]: https://github.com/AlexRogalskiy/github-action-tag-replacer/graphs/contributors
[license_id]: https://img.shields.io/github/license/AlexRogalskiy/github-action-tag-replacer
[license_content]: https://github.com/AlexRogalskiy/github-action-tag-replacer/blob/master/LICENSE
[total_usages]: https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-git-master.endbug.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3DAlexRogalskiy%2Fgithub-action-tag-replacer%26badge%3Dtrue
[search_results]: https://github.com/search?o=desc&q=AlexRogalskiy/github-action-tag-replacer+path%3A.github%2Fworkflows+language%3AYAML&s=&type=Code