Auto-update README.md file according to the source code. When to use this action?
Tested in unfor19/replacer-action-test
README.mdREADME.md<!-- replacer_start -->
<div>User name will appear here instead</div>
<!-- replacer_end -->
$ echo -e '<div>This is the incoming text block</div>\n<div>It worked!</div>' > test_results.log
name: Update README.md
on:
push:
branches: [master]
# IMPORTANT: Avoids endless loop
paths-ignore:
- "README.md"
jobs:
update-readme:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Prepare source file
run: |
echo "<div>$(whoami)</div>" > test_results.log
- uses: unfor19/replacer-action@v1
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: "replacer-action"
git-user-email: "[email protected]"
git-commit-msg: "Updated by GitHub Actions"
git-skip-commit: false
git-skip-push: false
create-backup: true
./entrypoint.sh --help
Usage: bash entrypoint.sh --help
--src_file_path | -sf [ENV_VAR] Relative path to source file that will be injected
--dst_file_path | -df [README.md] Relative path to destination file
--start_value | -sv [<!-- replacer_start -->] From where to start
--end_value | -ev [<!-- replacer_end -->] Where to stop
--git_user_name | -gu [replacer-action] Actor user name
--git_user_email | -ge [replacer-action.co.il] Actor email address
--git_commit_msg | -gm [Updated by GitHub Actions] Git commit message
--git_skip_commit | -gsc [false] Skip Git commit
--git_skip_push | -gsp [false] Skip Git push
--create_backup | -cb [true] Create a backup file
NOTE: the code block above :point_up: was automatically generated with replacer! See the raw version of this README.md file
kind: pipeline
type: docker
name: testing-drone
steps:
- name: Prepare source file
image: alpine:3.12
cmd: |
echo "<div>$(whoami)</div>" > test_results.log
- name: Dry run
image: unfor19/replacer-action:latest
settings:
src_file_path: "test_results.log"
dst_file_path: "README.test.md"
start_value: "<!-- replacer_start -->"
end_value: "<!-- replacer_end -->"
git_user_name: "Drone"
git_user_email: "[email protected]"
git_commit_msg: "Updated by Drone.io"
git_skip_commit: false
git_skip_push: false
create_backup: true
Report issues/questions/feature requests on the Issues section.
Pull requests are welcome! These are the steps:
git checkout -b my-new-feature)docker build -t "replacer-action:dev" --target "dev" .
docker run --rm -it -v "$PWD":"/code" --workdir "/code" "replacer-action:dev"
# in container
./tests/test.sh
... # All good? Move on to the next step
git commit -am 'Added new feature')git push --set-up-stream origin my-new-feature)Created and maintained by Meir Gabay
This project is licensed under the MIT License - see the LICENSE file for details
Content type
Image
Digest
Size
21.8 MB
Last updated
almost 5 years ago
docker pull unfor19/replacer-action