Engin Diri
_CLOUD

Follow

_CLOUD

Follow
How to automate your GitHub profile README

How to automate your GitHub profile README

With some fancy GitHub actions from the marketplace

Engin Diri's photo
Engin Diri
ยทDec 25, 2021ยท

3 min read

Table of contents

  • Update: RSS support
  • GitHub Actions
  • Summary

image.png

Update: RSS support

Add this to your template README.md.tpl, and readme-scribe will parse an RSS feed and render them in your final README.md

#### ๐Ÿ“– My latest blog posts
{{- range rss "https://blog.ediri.io/rss.xml" 6 }}
- [{{ .Title }}]({{ .URL }}) ({{ humanize .PublishedAt }})
{{- end }}

Introduction

By now, most people on GitHub already know about the possibility of creating a GitHub profile README.

If not, click on the link to follow the steps in the official GitHub docs. Or check out some great videos on YouTube about setting up a basic profile page:

Here some good videos to start with:

or

But let us see, how we can make some parts of our profile dynamic and automate this with the help of GitHub actions.

GitHub Actions

The profile repo is the same as your normal code repositories. That means we can create GitHub actions and store them in the .github folder.

That said, let us see some of these GitHub actions in more detail.

GitHub Readme Stats

I absolutely love this project, the sheer amount of cards with different stats and the possibility to customize them is mind-blowing. Implementing them is even, easier. No templating stuff going on, just add them via Markdown syntax

![Engin`s GitHub stats](https://github-readme-stats.vercel.app/api?username=dirien&show_icons=true&theme=radical)

And that's how my Card looks like, with the radical theme enabled:

Engin`s GitHub stats

On top, you can host the backend, on your server. This is in case the service hits the 5k API rate limit from GitHub.

Credly Badge

With these cool GitHub actions, you can retrieve your Credly badges and display them in your README.

Simply create a GitHub workflow:

name: Update badges

on:
  schedule:
    # Runs at 0am UTC every day
    - cron: "0 0 * * *"
jobs:
  update-readme:
    name: Update Readme with badges
    runs-on: ubuntu-latest
    steps:
      - name: Badges - Readme
        uses: pemtajo/badge-readme@main
        with:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}
          COMMIT_MESSAGE: "My commit message to update badges"
          CREDLY_USER: <username_credly>
          CREDLY_SORT: POPULAR

And add these markers to your README

<!--START_SECTION:badges-->
<!--END_SECTION:badges-->

Voilร , you get the sweet badges, fetched and inserted. This is what my badges look like.

image.png

readme-scribe

readme-scribe is the next GitHub action, I love. It uses the powerful markscribe template engine.

All you need to do is create a README.md.tpl file and start to use the predefined functions.

#### ๐Ÿ‘ท Check out what I'm currently working on
{{range recentContributions 10}}
- [{{.Repo.Name}}]({{.Repo.URL}}) - {{.Repo.Description}} ({{humanize .OccurredAt}})
{{- end}}

#### ๐ŸŒฑ My latest projects
{{range recentRepos 10}}
- [{{.Name}}]({{.URL}}) - {{.Description}}
{{- end}}

You can update then the README page with some GitHub workflow.

name: Update README

on:
  push:
  schedule:
    - cron: "0 */1 * * *"

jobs:
  markscribe:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@master

      - uses: muesli/readme-scribe@master
        env:
          GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
        with:
          template: "templates/README.md.tpl"
          writeTo: "README.md"

      - uses: stefanzweifel/git-auto-commit-action@v4
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          commit_message: Update generated README
          branch: main
          commit_user_name: readme-scribe ๐Ÿค–
          commit_user_email: actions@github.com
          commit_author: readme-scribe ๐Ÿค– <actions@github.com>

My README file looks like this:

image.png

-> github.com/muesli/readme-scribe

Summary

That's it. You should have now some good idea of what is possible with the personal profile README file. You can now fully be creative and tell every visitor more about yourself.

This is how my profile README looks like this:

ย 
Share this