DEV Community

Cover image for Adding badges to your Github profile
Pedro Matias de Araujo
Pedro Matias de Araujo

Posted on • Originally published at Medium on

Adding badges to your Github profile

Badges are a great way to measure professional skills, so why not put them on your GitHub profile?


Recently, I started looking for ways to improve my professional skills and with that, I gained several Acclaim badges that are easily shared on LinkedIn, but not so easily shared on Github. And that led me to think of easy ways to automate this.

Over time, I became a huge fan of automation.

In programming and day-to-day tasks, It’s important not to waste time on rework.

I was already thinking about automatically updating my Github with these badges as I said before and this mentality joined my desire to create a project where I could learn more about creating actions on Github.

This is a good way to show more effectively what I am studying and still have the opportunity to learn more in the process, consequently generating value for what I am doing.

Creation the code

I started to study the Acclaim to see if there were any APIs to receive these values, but I didn’t find anything for the user, just for organizations.

As it was only necessary the name, the image, and possibly the link of the badge I had the idea of ​​using a web scraping on the public website to include the values ​​that I needed. And it worked very well, with that I was able to receive the values ​​and generate HTML tags for the markdown.

But there was still the challenge of creating action on Github and the problem was simpler than I thought. Was just create an action.yml, put all my code in the docker and it worked as expected.

Using

Setting up on your GitHub profile is simple, you just need to do this:

  1. hit New workflow, set up a workflow yourself, delete all the default content GitHub made for you.
  2. Copy the following code and paste it to the new workflow you created at step 1:
name: Update badges

on:
  schedule:
    # Runs at 2am UTC
    - cron: "0 2 * * *"
jobs:
  update-readme:
    name: Update Readme with badges
    runs-on: ubuntu-latest
    steps:
      - name: Badges - Readme
        uses: pemtajo/badge-readme@master
          ACCLAIM_USER: <username_acclaim> # optional, but default will use the same from github
Enter fullscreen mode Exit fullscreen mode
  1. Add a comment to your README.md like this:
<!--START_SECTION:badges-->
<!--END_SECTION:badges-->
Enter fullscreen mode Exit fullscreen mode

The result will look like this

https://github.com/pemtajo
https://github.com/pemtajo

How to contribute

pemtajo/badge-readme

More details on README

Feel free to fork and use.

If you have any problems or have another badge supplier, let’s talk and improve the project.

See you soon!

Top comments (0)