AlexRogalskiy / github-action-tag-replacer

🏷️ GitHub action to replace placeholders in files
https://github.com/marketplace/actions/tag-replacer
GNU General Public License v3.0
2 stars 1 forks source link
github-actions replace-text

Tag Replacer

GitHub Action to replace tags in files

GitHub marketplace

management: perfekt👌 code style: prettier Mergify Status Reviewed by Hound Chat

DeepSource DeepScan grade GitHub tag (latest by date) GitHub Release Date Lines of code GitHub closed issues GitHub closed pull requests GitHub repo size GitHub last commit GitHub language count GitHub search hit counter GitHub Repository branches GitHub Repository dependents Renovatebot Dependabot NewReleases Hits-of-Code dependencies Status dependencies Status

Codeac Coverage Status codebeat badge Total alerts Language grade: JavaScript codecov CI CircleCI GitHub Super-Linter Commitizen friendly ComVer Public workflows that use this action. Licence

Chat Open questions Open bugs

Table of contents

Description

Typescript Project Status: Active – The project has reached a stable, usable state and is being actively developed. Project created status Project updated status

Processes input file by replacing tags with provided input parameters.

Inputs

sourceData

Optional JSON data source file with action parameters:

Complete 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>"
    }
]

Basic parameters

[
    {
        "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

Outputs

changed

File processing operation status

true

When input source file successfully processed

false

When error occurred while processing input source file

Examples

- 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:

Visitor stats

GitHub page hits

GitHub stars GitHub forks GitHub watchers

Licensing

Tag Replacer is distributed under LGPL version 3 or later, [License]. LGPLv3 is additional permissions on top of GPLv3.

license

Authors

Tag Replacer is maintained by the following GitHub team-members:

with community support please contact with us if you have some question or proposition.

Versioning

The project uses SemVer for versioning. For the versions available, see the tags on this repository.

Contribution

Contributors Display

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!

PRs Welcome Github contributors

See also the list of contributors who participated in this project.

Acknowledgement

Stargazers repo roster for @AlexRogalskiy/github-action-tag-replacer

Forks

Forkers repo roster for @AlexRogalskiy/github-action-tag-replacer

Development Support

Like Tag Replacer ? Consider buying me a coffee :)

Become a Patron Buy Me A Coffee KoFi


forthebadge forthebadge forthebadge