Golang-tutorial icon indicating copy to clipboard operation
Golang-tutorial copied to clipboard

📚 Documentation: Update index in README.md add links for updated files and folder

Open SagarSingh2003 opened this issue 1 year ago • 6 comments

💬 Description

  • [ ] add all the links for notes and main.go files that were added recently and not present in readme

you can take reference from this readme

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🔖 Have you read the Code of Conduct?

  • [X] Please search to see if an issue already exists for the bug or typo error you wanna add.

SagarSingh2003 avatar Jul 11 '23 18:07 SagarSingh2003

@SagarSingh2003, can we use github actions to auto update README.md file whenever there is a merge into main branch

bvvnmanikanta avatar Jul 17 '23 03:07 bvvnmanikanta

@SagarSingh2003, can we use github actions to auto update README.md file whenever there is a merge into main branch

great idea @bvvnmanikanta !! please go ahead and raise an issue for it ^^ .

SagarSingh2003 avatar Jul 17 '23 08:07 SagarSingh2003

@SagarSingh2003, can we use github actions to auto update README.md file whenever there is a merge into main branch

@bvvnmanikanta how will you proceed with this? How action will know which part of Readme needs update?

Yashsharma1911 avatar Jul 19 '23 15:07 Yashsharma1911

I don't mean to scare you with these questions just curious to know do you have any approach or you'll do research on it

Yashsharma1911 avatar Jul 19 '23 15:07 Yashsharma1911

@Yashsharma1911, I checked an article that discussed dynamically updating the readme.md file. PFB sample code for updating the readme file with files list.

name: Update README

on:
  repository_dispatch:
    types: update-readme

jobs:
  update-readme:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Generate file list
        run: |
          files=""
          for dir in */; do
            if [ -d "$dir" ]; then
              files+="- [$dir]($dir)\n"
              for file in "$dir"/*; do
                if [ -f "$file" ]; then
                  filename=$(basename "$file")
                  files+="  - [$filename]($dir$filename)\n"
                fi
              done
            fi
          done
          sed -i "s|<!-- FILE_LIST -->|$files|" README.md

      - name: Commit changes
        run: |
          git config --local user.email "[email protected]"
          git config --local user.name "GitHub Action"
          git add README.md
          git commit -m "Update main README.md with file links"
          git push

Still need to work on it.

bvvnmanikanta avatar Jul 19 '23 18:07 bvvnmanikanta

if that is the case @bvvnmanikanta please go ahead ^^

Yashsharma1911 avatar Jul 22 '23 17:07 Yashsharma1911