Engin Diri
_CLOUD

_CLOUD

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

Published on Dec 25, 2021

3 min read

Table of contents

  • Introduction
  • GitHub Actions
  • Summary

image.png

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 absolutely the same as your normal code repositories. That means, we can create a 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 own server. This is in case the service hits the 5k API rate limiting from GitHub.

-> github.com/anuraghazra/github-readme-stats

Credly Badge

With this 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 into your README

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

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

image.png

-> github.com/pemtajo/badge-readme#other-repos..

readme-scribe

readme-scribe is the next GitHub action, I really 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 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: --> github.com/dirien

 
Share this