Skip to content

TryHackMe Badge Action Workflow

Actions
A github action for tryhackme to fetch and regenerate static badge image which can be used in the README
v1.0
Latest
Star (6)

Tags

 (2)

tryhackme-badge-action-workflow

A github action for tryhackme to fetch and regenerate static badge image which can be used in the Readme

This is a GitHub Action that fetches your latest TryHackMe badge, downloads it, and commits it to your repository.

Features

  • Fetches the latest badge based on your TryHackMe user ID.
  • Downloads the badge image to a specified file path.
  • Commits the downloaded image to your repository with a custom message.
  • Allows setting a custom committer username.

Usage

  • Add this 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). Eg) 1995656
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-22.04

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

    - name: Configure Git Identity
      run: |
        git config --global user.name "GitHub Actions Bot"
        git config --global user.email "[email protected]"

    - 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 }}

TryHackMe Badge Action Workflow is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

A github action for tryhackme to fetch and regenerate static badge image which can be used in the README
v1.0
Latest

Tags

 (2)

TryHackMe Badge Action Workflow is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.