LinkMedkit
A set of bash scripts for repository badges. These scripts read input from file in json format conforming a schema compatible with shields.io JSON format.
-
scripts/badger.py
: generates a SVG badge. -
scripts/gitlab_badge_sticker.sh
: updates GitLab repository badges.
Quick Start
Install Dependecies
- Install
python3
and a python3 package manager e.g.pip
- Install python dependecies:
pip install -r scripts/badger.requirements.txt
Prepare Input
Example badge file examples/badge.test.json
:
{
"schemaVersion": 1,
"label": "dead%20internal%20links",
"message": 0,
"color": "green"
}
Generate SVG Badge
badger.py --input-file="badge.test.json"
It will generate test.svg
file as:
Update GitLab Repository Badge
gitlab_badge_sticker.sh
Usage & Options
Badger
- Display help. Will show all the command line options and their default values.
badger.py -help
- Read
badge.dead_internal_links.json
file, create a badge file nameddead_internal_links.svg
.
badger.py
- Read the number of dead links from
badge.dead_external_links.json
file.
badger.py --input-file="badge.dead_external_links.json"
- Generate badge file
public/dead_external.svg
. Create the parent directories if missing.
badger.py --output-file="public/dead_external.svg"
- Run
badger.py
in verbose mode
badger.py --verbose
GitLab Badge Updater
-
Find files named
badge.*.json
and update GitLab repository badges named (*
) or creates them if not found. The badges are set to be rendered by shields.io and will be linked to the GitLab CI job which has set them.This script requires an access token called
CI_API_TOKEN
for the project with maintainer permission and "api, read_api" scopes to modify the badges. Please add the required API access token to your project and set it as a masked variable in CI.
gitlab_badge_sticker.sh
- Run
gitlab_badge_sticker.sh
in verbose mode.
gitlab_badge_sticker.sh --verbose
Background
These scripts were originally developed for linkmedic.
License
Copyright 2021-2023 M. Farzalipour Tabriz, Max Planck Computing and Data Facility (MPCDF)
Copyright 2025 M. Farzalipour Tabriz, Max Planck Institute for Physics (MPP)
All rights reserved.
This software may be modified and distributed under the terms of the 3-Clause BSD License. See the LICENSE file for details.