All Projects β†’ varunsridharan β†’ action-dynamic-readme

varunsridharan / action-dynamic-readme

Licence: MIT license
~ Dynamic ReadME Generator ~

Programming Languages

PHP
23972 projects - #3 most used programming language
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to action-dynamic-readme

Readme Md Generator
πŸ“„ CLI that generates beautiful README.md files
Stars: ✭ 9,184 (+31568.97%)
Mutual labels:  readme, readme-template, readme-generator
assign-one-project-github-action
Automatically add an issue or pull request to specific GitHub Project(s) when you create and/or label them.
Stars: ✭ 140 (+382.76%)
Mutual labels:  actions, action, github-action
setup-jdk
(DEPRECATED) Set up your GitHub Actions workflow with a specific version of AdoptOpenJDK
Stars: ✭ 32 (+10.34%)
Mutual labels:  actions, action, github-action
clojure-dependency-update-action
A simple GitHub Actions job to create Pull Requests for outdated dependencies in clojure projects
Stars: ✭ 37 (+27.59%)
Mutual labels:  actions, action, github-action
autobadge
Simple CLI tool to generate essential repository badges with ease
Stars: ✭ 16 (-44.83%)
Mutual labels:  readme, readme-template, readme-generator
The Documentation Compendium
πŸ“’ Various README templates & tips on writing high-quality documentation that people want to read.
Stars: ✭ 4,306 (+14748.28%)
Mutual labels:  readme, readme-template, readme-bolierplate
Metrics
πŸ“Š An infographics generator with 30+ plugins and 200+ options to display stats about your GitHub account and render them as SVG, Markdown, PDF or JSON!
Stars: ✭ 4,621 (+15834.48%)
Mutual labels:  readme, github-action, readme-generator
readme-generator
πŸ“¦πŸ“ Personal generator to simply create cool and efficients README.md
Stars: ✭ 32 (+10.34%)
Mutual labels:  readme, readme-template, readme-generator
github-run-tests-action
mabl Github Actions implementation
Stars: ✭ 39 (+34.48%)
Mutual labels:  actions, action, github-action
action-sync-node-meta
GitHub Action that syncs package.json with the repository metadata.
Stars: ✭ 25 (-13.79%)
Mutual labels:  actions, action, github-action
ssh2actions
Connect to GitHub Actions VM via SSH for interactive debugging
Stars: ✭ 62 (+113.79%)
Mutual labels:  actions, action, github-action
github-readme-linkedin
πŸ“‹ A serverless application to get dynamically generated images from your LinkedIn profile on your GitHub READMEs
Stars: ✭ 52 (+79.31%)
Mutual labels:  readme, dynamic, readme-generator
github-profile-views-counter
Github new features README profile views counter made with Yii2 framework.
Stars: ✭ 158 (+444.83%)
Mutual labels:  readme, readme-template, readme-generator
init-readme
An opinionated README.md generator for npm utility packages
Stars: ✭ 12 (-58.62%)
Mutual labels:  readme, readme-template, readme-generator
Magento-Extension-Sample-Readme
This is an attempt to develop a default readme file for Magento extensions. It should be included in the Magento extension directory under e.g. app/code/community/Company/ExampleExtension/readme.markdown. The markdown syntax (http://daringfireball.net/projects/markdown/syntax) is used for better and consistent formatting. Please join the discuss…
Stars: ✭ 14 (-51.72%)
Mutual labels:  readme, readme-template
readme-typing-svg
⚑ Dynamically generated, customizable SVG that gives the appearance of typing and deleting text. Typing SVGs can be used as a bio on your Github profile readme or repository.
Stars: ✭ 938 (+3134.48%)
Mutual labels:  readme, dynamic
guilyx
Dynamic Profile with github statistics, coding info (time and languages) with WakaTime and music status with the spotify API, leave a ⭐ if you like it
Stars: ✭ 175 (+503.45%)
Mutual labels:  readme, dynamic
jovanzers
Don't just fork, star it! πŸ‘€
Stars: ✭ 13 (-55.17%)
Mutual labels:  readme, readme-template
action-my-broken-link-checker
A GitHub Action for checking broken links
Stars: ✭ 32 (+10.34%)
Mutual labels:  actions, github-action
SamirPaul1
πŸ€– My GitHub Profile README ✨
Stars: ✭ 26 (-10.34%)
Mutual labels:  readme, readme-template

Dynamic ReadMe - Github Action

Convert Static Readme into Dynamic Readme

Motivation

As an open-source software developer I use GitHub Repositories extensively to store my projects. I maintain over 100 projects, of which, about 85% of them have standardised content for the README.md file. That being said, I am finding it increasingly tedious to add, update or remove content in the README.md files across all my repositories because of two main challenges:

  1. Templating of files: The information which is common to README.md files across all my repositories such as Sponsor, Contribute, Contact, etc., cannot be templated and inserted into the README.md files of all my projects / repositories.

  2. Project / Repository-specific information: Github does not provide any repository-specific variables which can be used to dynamically insert repository information into the README.md file. As a result, repository-specific information needs to be hard-coded into the README file.

Solution:

To overcome this limitation, and help developers such as myself automate this tedious task, I have created a GitHub action called β€œGithub Action Dynamic ReadMe”. This action pulls repository-specific variables and also allows for templating of files, thereby easily creating dynamic file content for files such as README.md.

βš™οΈ Configuration

Option Description Default
FILES list of files that should be compiled. false
DELIMITER you can change the default DELIMITER if it causes issue with your data. ${{ }}
GLOBAL_TEMPLATE_REPOSITORY you can set a global repository template where all the files are stored. false
committer_name Specify the committer name Dynamic Readme
committer_email Specify the committer email [email protected]
commit_message set a custom commit message πŸ’¬ - File Rebuilt - Github Action Runner : ${GITHUB_RUN_NUMBER}
confirm_and_push Commit the changes and push directly to repository true

✍️ Syntax

  • Variables : ${{ VARIABLE_NAME }}
  • Inline File Includes : <!-- include {filepath} -->
  • Reusable File Includes :
    • Start : <!-- START include {filepath} -->
    • END : <!-- END include {filepath} -->

Variables

All Default vairables exposed by github actions runner can be accessed like $β€Ž{{ GITHUB_ACTIONS }} OR $β€Ž{{ GITHUB_ACTOR }}

Dynamic Readme Github Action Uses Repository Meta - Github Action which exposes useful metadata as environment variable and those variables can be used as template tags.

any variables exposed by Repository Meta can be accessed like below

Repository Owner : ${{ env.REPOSITORY_OWNER }}
Repository Full Name : ${{ env.REPOSITORY_FULL_NAME }}

ℹ️ Note : Any environment variable can be accessed just by using env. as prefix ${{ env.VARIABLE_NAME }}

File Includes

Source Options

  • Relative Path : template/file.md
  • Absolute path : ./template/file.md
  • From Repository : {owner}/{repository}/{filepath} OR {owner}/{repository}@{branch}/{filepath}

Relative Path Syntax

Files are always searched from repository root path

Inline Includes : 
<!-- include template/file.md -->

Reusable Includes : 
<!-- START template/file.md -->

<!-- END template/file.md -->

Absolute path Syntax

Files are searched from current repository. This can come in handy when writing nested includesType a message

Inline Includes : 
<!-- include ./template/file.md -->

Reusable Includes : 
<!-- START ./template/file.md -->

<!-- END ./template/file.md -->

From Repository Syntax

You can include any type of file from any repository. If you want to include a file from a Private Repository, you have to provide Github Personal Access Token INSTEAD OF Github Token in the action's workflow file.

ℹ️ If branch is not specified then default branch will be cloned

Without Branch
Inline Includes : 
<!-- include octocat/Spoon-Knife/README.md -->

Reusable Includes : 
<!-- START octocat/Spoon-Knife/README.md -->

<!-- END octocat/Spoon-Knife/README.md -->
Custom Branch
Inline Includes : 
<!-- include octocat/Spoon-Knife/@master/README.md -->

Reusable Includes : 
<!-- START octocat/Spoon-Knife/@master/README.md -->

<!-- END octocat/Spoon-Knife/@master/README.md -->

Builtin Markdown Handlers

blow options can be used with inline / resuable includes.

  • code - [code] OR [code:{code_type}] - will print the contents of the file inside a codeblock
  • blockquote - [blockquote] - will print the contents of the file inside a blockquote
  • raw - [raw] OR [escape] - will print the actual contents without rendering it.
Example
Inline Includes With Custom Markdown Below file will be included inside HTML blockquote element
<!-- include [code] template/thankyou.md --> 

Inline Includes With Custom Markdown Below file will be included inside HTML blockquote element
<!-- include [code:json] template/contents.json --> 

Reusable Includes Custom Markdown :
<!-- START [code] template/file.md -->
<!-- END [code] template/file.md -->

Reusable Includes Custom Markdown :
<!-- START [code:json] template/contents.json -->
<!-- END [code:json] template/contents.json -->

ℹ️ Inline includes can come in handy when you want to parse the data once and save it. It can also be used inside a nested include.

ℹ️ Even though Reusable includes and Inline Includes do the same work, they can come in handy when you are generating a template and saving it in the same file. It preserves the include comment which will be parsed again when re-generating the template, and the contents of the include will be updated accordingly.

Pull Request Support

This action modifies the files, creates a commit and uploads them directly to the default branch of the repository.

If the default branch of the repository is protected by the rule Require a pull request before merging then you will need to set the option confirm_and_push: false so that the commit is not made and the changes are not uploaded to the default branch.

- name: "πŸ’«  Dynamic Template Render"
  uses: varunsridharan/action-dynamic-readme@main
  with:
    GLOBAL_TEMPLATE_REPOSITORY: {repository-owner}/{repository-name}
    files: |
      FILE.md
      FILE2.md=output_filename.md
      folder1/file.md=folder2/output.md
    confirm_and_push: false # Important if use "Require a pull request before merging" rule
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

In addition to the previous configuration, it is necessary to use other actions to be able to confirm the changes and generate a Pull Request towards the default branch

- name: "πŸ“₯  Fetching Repository Contents"
  uses: actions/checkout@main

- name: "πŸ’«  Dynamic Template Render"
  uses: varunsridharan/action-dynamic-readme@main
  with:
    GLOBAL_TEMPLATE_REPOSITORY: {repository-owner}/{repository-name}
    files: |
      FILE.md
      FILE2.md=output_filename.md
      folder1/file.md=folder2/output.md
    confirm_and_push: false # Important if use "Require a pull request before merging" rule
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create pull request
  uses: peter-evans/create-pull-request@v3
  with:
    token: ${{ secrets.GITHUB_TOKEN }}

Thanks to this configuration, the necessary files can be dynamically generated by adding them to a different branch that then we can merge with the default branch, complying with the rule Require a pull request before merging.

Check out the example workflow (Pull Request Support) for a more advanced configuration


For live Demo Please Check Demo Repository


πŸš€ Example Workflow File

name: Dynamic Template

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  update_templates:
    name: "Update Templates"
    runs-on: ubuntu-latest
    steps:
      - name: "πŸ“₯  Fetching Repository Contents"
        uses: actions/checkout@main

      - name: "πŸ’Ύ  Github Repository Metadata"
        uses: varunsridharan/action-repository-meta@main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: "πŸ’«  Dynamic Template Render"
        uses: varunsridharan/action-dynamic-readme@main
        with:
          GLOBAL_TEMPLATE_REPOSITORY: {repository-owner}/{repository-name}
          files: |
            FILE.md
            FILE2.md=output_filename.md
            folder1/file.md=folder2/output.md
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

πŸš€ Example Workflow File (Pull Request Support)

name: Dynamic Template

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  update_templates:
    name: "Update Templates"
    runs-on: ubuntu-latest
    steps:
      - name: "πŸ“₯  Fetching Repository Contents"
        uses: actions/checkout@main

      - name: "πŸ’Ύ  Github Repository Metadata"
        uses: varunsridharan/action-repository-meta@main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: "πŸ’«  Dynamic Template Render"
        uses: varunsridharan/action-dynamic-readme@main
        with:
          GLOBAL_TEMPLATE_REPOSITORY: {repository-owner}/{repository-name}
          files: |
            FILE.md
            FILE2.md=output_filename.md
            folder1/file.md=folder2/output.md
          committer_name: github-actions[bot]
          committer_email: github-actions[bot]@users.noreply.github.com
          commit_message: 'docs: update readme file [skip ci]'
          confirm_and_push: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Create pull request
        id: cpr
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: 'docs: documentation files updated [skip ci]'
          committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
          author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
          signoff: false
          branch: github-actions/repository-maintenance
          delete-branch: true
          title: Update documentation files
          body: All documentation files has been updated to last recent version
          labels: |
            skip-changelog
            docs

      - name: Enable pull request automerge
        if: steps.cpr.outputs.pull-request-operation == 'created'
        uses: peter-evans/enable-pull-request-automerge@v1
        with:
          token: ${{ secrets.PAT }}
          pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}

      - name: Auto approve
        if: steps.cpr.outputs.pull-request-operation == 'created'
        uses: juliangruber/approve-pull-request-action@v1
        with:
          github-token: ${{ secrets.PAT }}
          number: ${{ steps.cpr.outputs.pull-request-number }}

πŸ“ Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Checkout CHANGELOG.md

🀝 Contributing

If you would like to help, please take a look at the list of issues.

πŸ“œ License & Conduct

πŸ“£ Feedback

  • ⭐ This repository if this project helped you! πŸ˜‰
  • Create An πŸ”§ Issue if you need help / found a bug

πŸ’° Sponsor

I fell in love with open-source in 2013 and there has been no looking back since! You can read more about me here. If you, or your company, use any of my projects or like what I’m doing, kindly consider backing me. I'm in this for the long run.

  • β˜• How about we get to know each other over coffee? Buy me a cup for just $9.99
  • β˜•οΈβ˜•οΈ How about buying me just 2 cups of coffee each month? You can do that for as little as $9.99
  • πŸ”° We love bettering open-source projects. Support 1-hour of open-source maintenance for $24.99 one-time?
  • πŸš€ Love open-source tools? Me too! How about supporting one hour of open-source development for just $49.99 one-time ?

Connect & Say πŸ‘‹


Built With β™₯ By Varun Sridharan


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].