Skip to content
save

GitHub Action

Dynamic update Readme

v1.0.2 Latest version

Dynamic update Readme

save

Dynamic update Readme

Update any content to GitHub profile's readme or any markdown dynamically

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Dynamic update Readme

uses: gnpaone/[email protected]

Learn more about this action in gnpaone/dynamic-update-readme

Choose a version

Dynamic Update Readme

Releases Build LICENSE Issues Go Godoc Go Report Card GitHub Marketplace

As a power user, automate the updating of markdown text with content obtained from other actions in the workflow, as well as a Go module that can update markdown text


Introduction

A Go module that updates markdown text and is integrated as a GitHub Action.

Parameters

Parameter Workflow default Description Required Possible values
readme_path ./README.md Path of the markdown file No File path relative to the root directory of the GitHub repo
marker_text null Marker text to replace in markdown file Yes Example markers to be added in the markdown:
<!-- marker_text_START --><!-- marker_text_END -->
markdown_text null Markdown text that needs to be updated Yes Any markdown compatible text
table false Markdown text is a table No true, false
table_options null Alignment for the table No align-Alignment, col-Column-align-Alignment, col-Column-w-Min-width

Alignment: left, right, center
Column: Column number of the table (starts with 0)
Min-width: Minimum width of a column (in other words, minimum number of hyphens (-) in the delimiter row)

Notes:

  • Make sure to change the following in your GitHub repo settings: Actions > General > Workflow permissions > Choose Read and write permissions > Check Allow GitHub Actions to create and approve pull requests > Save.
  • Other parameters commit_user, commit_email, commit_message and confirm_and_push related to action workflow are optional.
  • If confirm_and_push is "false" committer detalis can be accessed via outputs.commit_user, outputs.commit_email & outputs.commit_message for further usage in the workflow.
  • The syntax mostly revolves around GitHub Flavored Markdown parser.
  • The table parameter is optional as markdown_text supports table markdown syntax by default but this parameter can be used as a simple alternative or any special use case. If table is "true":
    • It uses github.com/willabides/mdtable module.
    • markdown_text contents should follow these conditions:
      • Table row contents are seperated with ";" delimiter. First element will make up the table header.
      • For each element of table rows, table column contents are seperated with "," delimiter.
    • table_options can be used only if table is "true".
      • Description of options/values:
        1. align-: This option aligns the whole table according to the alignment set.
        2. col-: This option sets properties of any particular column based on the column number.
      • Order of preference of the alignment options: col- > align-
  • The markdown file must contain start marker <!-- EXAMPLE_MARKER_START --> and end marker <!-- EXAMPLE_MARKER_END --> where "EXAMPLE_MARKER" is the input of marker_text parameter. Note that the _START and _END part is important.

Usage

Check the example workflow here.

Contributing

See CONTRIBUTING.md for more details.

Acknowledgements

This project uses few of the open-source Go modules, without which it would not have been possible. I extend my gratitude to the developers and maintainers of these modules for their valuable contributions to the open-source community:

License

This project is licensed under GPL-3.0.
Copyright © 2024, Naveen Prashanth. All Rights Reserved.