Skip to content

A Go module to update any text or markdown content to any markdown file integrated as a GitHub action

License

Notifications You must be signed in to change notification settings

gnpaone/dynamic-update-readme

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A Go module to update any text or markdown content to any markdown file integrated as a GitHub action

Resources

License

Stars

Watchers

Forks

Sponsor this project