{"id":16725242,"url":"https://github.com/unfor19/replacer-action","last_synced_at":"2025-04-10T10:22:50.951Z","repository":{"id":65162150,"uuid":"287395008","full_name":"unfor19/replacer-action","owner":"unfor19","description":"Auto-update README.md file according to the source code.","archived":false,"fork":false,"pushed_at":"2023-12-30T17:32:06.000Z","size":82,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T09:11:30.265Z","etag":null,"topics":["github-actions","inject","text"],"latest_commit_sha":null,"homepage":"https://meirg.co.il","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unfor19.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-13T22:54:13.000Z","updated_at":"2021-12-04T19:42:04.000Z","dependencies_parsed_at":"2023-01-04T12:39:05.668Z","dependency_job_id":null,"html_url":"https://github.com/unfor19/replacer-action","commit_stats":{"total_commits":212,"total_committers":6,"mean_commits":"35.333333333333336","dds":0.6037735849056604,"last_synced_commit":"7fbb8ae871c36b0e42b33f3d632efdfbc81863e2"},"previous_names":[],"tags_count":9,"template":true,"template_full_name":"unfor19/replacer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfor19%2Freplacer-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfor19%2Freplacer-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfor19%2Freplacer-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfor19%2Freplacer-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unfor19","download_url":"https://codeload.github.com/unfor19/replacer-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248040713,"owners_count":21037925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","inject","text"],"created_at":"2024-10-12T22:48:27.387Z","updated_at":"2025-04-10T10:22:50.915Z","avatar_url":"https://github.com/unfor19.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# replacer-action\n\n[![testing](https://github.com/unfor19/replacer-action/workflows/testing/badge.svg)](https://github.com/unfor19/replacer-action/actions?query=workflow%3Atesting)\n[![test-action](https://github.com/unfor19/replacer-action-test/workflows/test-action/badge.svg)](https://github.com/unfor19/replacer-action-test/actions?query=workflow%3Atest-action)\n\n\nAuto-update README.md file according to the source code. When to use this action?\n\n- **CLI Help Menu**: Inject the *help menu* of your CLI to the *README.md* file, see [Help Menu](#help-menu)\n- **Test Results**: Share test results in your *README.md* file, see [bargs test suite](https://github.com/unfor19/bargs#usage-output)\n- **API Response**: Keep your README.md up-to-date with the response of your APIs\n\nTested in [unfor19/replacer-action-test](https://github.com/unfor19/replacer-action-test/actions?query=workflow%3Atest-action)\n\n## How It Works\n\n1. Uses [perl](https://marekbosman.com/site/perl-find-and-replace/) to manipulate the destination file - `README.md`\n2. Executes [git diff](https://git-scm.com/docs/git-diff) to check if there are any changes in `README.md`\n3. If there are no changes, exits successfully\n4. If there are changes, executes [git commit](https://git-scm.com/docs/git-commit) followed by [git push](https://git-scm.com/docs/git-push)\n\n## Requirements\n\n1. Insert a start tag and stop tag to a text file, for example\n\n```html\n\u003c!-- replacer_start --\u003e\n\n\u003cdiv\u003eUser name will appear here instead\u003c/div\u003e\n\n\u003c!-- replacer_end --\u003e\n```\n\n2. Prepare a file with the text that you want to inject\n\n```bash\n$ echo -e '\u003cdiv\u003eThis is the incoming text block\u003c/div\u003e\\n\u003cdiv\u003eIt worked!\u003c/div\u003e' \u003e test_results.log\n```\n\n## Usage\n\n### GitHub Action\n\n```yaml\nname: Update README.md\non:\n  push:\n    branches: [master]\n    # IMPORTANT: Avoids endless loop\n    paths-ignore:\n      - \"README.md\"\n\njobs:\n  update-readme:\n    runs-on: ubuntu-20.04\n    steps:\n      - uses: actions/checkout@v2\n      - name: Prepare source file\n        run: |\n          echo \"\u003cdiv\u003e$(whoami)\u003c/div\u003e\" \u003e test_results.log\n      - uses: unfor19/replacer-action@v1\n        name: Update README.md file\n        with:\n          src-file-path: \"test_results.log\"\n          dst-file-path: \"README.md\"\n          start-value: \"\u003c!-- replacer_start --\u003e\"\n          end-value: \"\u003c!-- replacer_end --\u003e\"\n          git-user-name: \"replacer-action\"\n          git-user-email: \"replacer-action@meirg.co.il\"\n          git-commit-msg: \"Updated by GitHub Actions\"\n          git-skip-commit: false\n          git-skip-push: false\n          create-backup: true\n```\n\n### Help Menu\n\n```bash\n./entrypoint.sh --help\n```\n\n\u003c!-- help_menu_start --\u003e\n\n```bash\n\nUsage: bash entrypoint.sh --help\n\n\t--src_file_path    |  -sf   [ENV_VAR]                      Relative path to source file that will be injected\n\t--dst_file_path    |  -df   [README.md]                    Relative path to destination file\n\t--start_value      |  -sv   [\u003c!-- replacer_start --\u003e]      From where to start\n\t--end_value        |  -ev   [\u003c!-- replacer_end --\u003e]        Where to stop\n\t--git_user_name    |  -gu   [replacer-action]              Actor user name\n\t--git_user_email   |  -ge   [replacer-action.co.il]  Actor email address\n\t--git_commit_msg   |  -gm   [Updated by GitHub Actions]    Git commit message\n\t--git_skip_commit  |  -gsc  [false]                        Skip Git commit\n\t--git_skip_push    |  -gsp  [false]                        Skip Git push\n\t--create_backup    |  -cb   [true]                         Create a backup file\n```\n\u003c!-- help_menu_end --\u003e\n\n_NOTE_: the code block above :point_up: was automatically generated with replacer! See the raw version of this [README.md](https://raw.githubusercontent.com/unfor19/replacer-action/master/README.md) file\n\n\n### drone.io\n\n\u003cdetails\u003e\n\n\u003csummary\u003eExpand/Collapse\u003c/summary\u003e\n\n```yaml\nkind: pipeline\ntype: docker\nname: testing-drone\n\nsteps:\n  - name: Prepare source file\n    image: alpine:3.12\n    cmd: |\n      echo \"\u003cdiv\u003e$(whoami)\u003c/div\u003e\" \u003e test_results.log\n  - name: Dry run\n    image: unfor19/replacer-action:latest\n    settings:\n      src_file_path: \"test_results.log\"\n      dst_file_path: \"README.test.md\"\n      start_value: \"\u003c!-- replacer_start --\u003e\"\n      end_value: \"\u003c!-- replacer_end --\u003e\"\n      git_user_name: \"Drone\"\n      git_user_email: \"drone@meirg.co.il\"\n      git_commit_msg: \"Updated by Drone.io\"\n      git_skip_commit: false\n      git_skip_push: false\n      create_backup: true\n```\n\n\u003c/details\u003e\n\n## Contributing\n\nReport issues/questions/feature requests on the [Issues](https://github.com/unfor19/replacer-action/issues) section.\n\nPull requests are welcome! These are the steps:\n\n1. Fork this repo\n1. Create your feature branch from master (`git checkout -b my-new-feature`)\n1. Build development image\n   ```bash\n   docker build -t \"replacer-action:dev\" --target \"dev\" .\n   ```\n1. Run development image\n   ```bash\n   docker run --rm -it -v \"$PWD\":\"/code\" --workdir \"/code\" \"replacer-action:dev\"\n   ```\n1. Add the code of your new feature\n1. Run tests on your code, feel free to add more tests\n   ```bash\n   # in container\n   ./tests/test.sh\n   ... # All good? Move on to the next step\n   ```\n1. Commit your remarkable changes (`git commit -am 'Added new feature'`)\n1. Push to the branch (`git push --set-up-stream origin my-new-feature`)\n1. Create a new Pull Request and provide details about your changes\n\n## Authors\n\nCreated and maintained by [Meir Gabay](https://github.com/unfor19)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/unfor19/replacer-action/blob/master/LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funfor19%2Freplacer-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funfor19%2Freplacer-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funfor19%2Freplacer-action/lists"}