My Workflow
This action assists with keeping README.md files up to date with your application's outputs.
Some use cases for auto-generating text blocks in a README.md file
- Showing available commands of the CLI that you've created (
--help
) - Results after querying an API endpoint
- Bragging with tests results
How it works
- Add
<! -- replacer_start -->
before the text block - Add
<!-- replacer_end -->
after the text block - Set the inputs
- src-file-path
- dst-file-path
For more information, jump to the Getting Started section
Submission Category:
- Maintainer Must-Haves
- DIY Deployments
Yaml File or Link to Code
unfor19 / replacer-action
Auto-update README.md file according to the source code.
replacer-action
Auto-update README.md file according to the source code. When to use this action?
- CLI Help Menu: Inject the help menu of your CLI to the README.md file, see Help Menu
- Test Results: Share test results in your README.md file, see bargs test suite
- API Response: Keep your README.md up-to-date with the response of your APIs
Tested in unfor19/replacer-action-test
How It Works
- Uses perl to manipulate the destination file -
README.md
- Executes git diff to check if there are any changes in
README.md
- If there are no changes, exits successfully
- If there are changes, executes git commit followed by git push
Requirements
- Insert a start tag and stop tag to a text file, for example
<!-- replacer_start -->
<div>User name will appear here instead</div>
<!-- replacer_end -->
- Prepare a file with the text that you want to inject
$ echo -e
…name: Update README.md
on:
push:
branches: [master]
paths-ignore:
- "README.md"
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare source file
run: |
echo "<div>$(whoami)</div>" > test_results.log
- uses: unfor19/replacer-action@v1.0.0
name: Update README.md file
with:
src-file-path: "test_results.log"
dst-file-path: "README.md"
start-value: "<!-- replacer_start -->"
end-value: "<!-- replacer_end -->"
git-user-name: "GitHub Actions"
git-user-email: "githubactions@meirg.co.il"
git-commit-msg: "Updated by GitHubActions"
git-skip-commit: false
git-skip-push: false
create-backup: true
Additional Resources / Info
Repositories which are using this workflow
- replacer - replacer-action is based on this repository and also uses replacer to auto-generate the help message
- bargs - Parsing command-line arguments in Bash easily, read more about it in this blog post. This repository is generating tests results automatically, see here
Feel free to doubt/ask questions/contribute to this project, any feedback is good feedback.
Top comments (0)