auto-update-readme.md-according-to-source-code

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

  1. Add <! -- replacer_start --> before the text block
  2. Add <!-- replacer_end --> after the text block
  3. 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

View in GitHub Market Place

{% github https://github.com/unfor19/replacer-action %}

pipeline.yml

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.


Originally published at https://dev.to on August 14, 2020.

Recommended Posts

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *