paint-brush
Introducing the TryHackMe Badge Action Workflow: Automate Your Security Achievements Displayby@dhanushnehru
208 reads

Introducing the TryHackMe Badge Action Workflow: Automate Your Security Achievements Display

by Dhanush NehruAugust 13th, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The TryHackMe Badge Action Workflow is a custom GitHub Action that refreshes and displays your TryHackme badge on your GitHub profile or repository README page. This action allows you to maintain your achievements up to date without having to manually download, update, or commit your badge picture each time you acquire a new one.
featured image - Introducing the TryHackMe Badge Action Workflow: Automate Your Security Achievements Display
Dhanush Nehru HackerNoon profile picture


As developers, we are constantly seeking for methods to demonstrate our abilities and accomplishments. TryHackMe provides an excellent forum for cybersecurity enthusiasts to learn and demonstrate their expertise. However, manually upgrading your TryHackMe badges can be tedious. That’s why I created the TryHackMe Badge Action Workflow, a GitHub Action that automates the process of displaying your TryHackMe achievements within your GitHub profile or repository.



In this blog article, I’ll explain why I created this action, how it works, and how you may use it in your own markdown files in github.

Motivation: Automating the Display of Achievements

TryHackMe is a tool that many people in the cybersecurity field use to sharpen their abilities. However, manually updating badges or tracking your progress might be time-consuming, especially if you want to share this information on your GitHub page. I thought of a solution that would automate this process, allowing anyone to demonstrate their TryHackMe achievements with no effort.

What Is the TryHackMe Badge Action Workflow?

The TryHackMe Badge Action Workflow is a custom GitHub Action that refreshes and displays your TryHackMe badge on your GitHub profile or repository README page. This action allows you to maintain your achievements up to date without having to manually download, update, or commit your badge picture each time you acquire a new one.

How It Works

This action updates your GitHub profile or repository README with the new image and retrieves your most recent TryHackMe badge. This is a summary of the workflow’s functions:

  • Image Fetching: The procedure begins with obtaining your TryHackMe badge’s most recent version from a given URL.
  • Commit Changes: The downloaded image is then committed to your repository, guaranteeing that the most recent badge is always visible.
  • README Update: Lastly, the action adds the updated badge image to your README file, allowing you to view your TryHackMe accomplishments in real time.

Usage

  • Add the below script to your GitHub repository as a .yml file (e.g., update-tryhackme-badge.yml).

  • Configure the action with the following inputs:

  • GITHUB_TOKEN: Your GitHub Personal Access Token (required, set as a secret).

  • image_path: The path to store the downloaded badge image (defaults to ./assets/tryhackme-badge.png).

  • username: Your TryHackMe username (defaults to the value in a secret named THM_USERNAME).

  • user_id: Your TryHackMe user ID (defaults to the value in a secret named THM_USER_ID).


name: Update TryHackMe Badge

on:
  schedule:
    - cron: '0 0 * * *' # Runs every day at midnight
  workflow_dispatch: # Allows manual triggering

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

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

    - name: Fetch TryHackMe Badge
      uses: DhanushNehru/[email protected]
      with:
        image_path: './assets/tryhackme-badge.png'
        username: 'your_tryhackme_username'
        user_id: 'your_tryhackme_user_id'
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


An easy-to-use yet effective solution for automating the display of your security accomplishments is the TryHackMe Badge Action Workflow.


If you liked the project as a source of encouragement and support please give it a star ⭐️👇


I have used this in my Github README.md so feel free to check it out


Thanks for reading, please give a like as a sort of encouragement and also share this post in socials to show your extended support.


Connect ⬇️


X / Instagram / Github / Youtube / Newsletter / Discord