Automatically display your Credly badges in your GitHub profile README
- About
- Why Version 3.1.0?
- Features
- Quick Start
- Configuration
- Troubleshooting
- Development
- Usage Examples
- Contributing
- Testing
- Technical Details
- Changelog
Badge Readme is an open-source GitHub Action that automatically fetches and displays your Credly badges in your GitHub profile README. It's designed to showcase your professional achievements and certifications in a clean, automated way.
- π Automatically updates your README with latest badges
- π Sorts badges by date (newest first)
- π¨ Clean markdown format for better compatibility
- β‘ Fast and reliable badge extraction
- π§ Easy to configure with minimal setup
Credly recently updated their website with a completely new HTML structure and user interface. This broke the existing badge extraction functionality in version 2.x.x.
- New HTML structure with different class names
- Dynamic badge loading (badges load progressively)
- Updated DOM elements for badge containers
- Changed date format and extraction methods
Version 3.1.0 completely refactors the badge extraction to work with Credly's new interface:
- β Automatic badge expansion - Clicks "See all badges" to load everything
- β Updated HTML parser - Works with new class names and structure
- β Enhanced date extraction - Handles new date formats
- β Improved reliability - Better error handling and fallbacks
- π― Smart Badge Extraction: Automatically expands to show all badges
- π Date-Based Sorting: Organizes badges by issue date (newest first)
- π Modern HTML Parser: Compatible with Credly's new interface
- π Clean Markdown: Simple, compatible output format
- πΎ Direct File Generation: Save badges to files programmatically
- π§ͺ Comprehensive Testing: Full test coverage for reliability
- π Automated Updates: Runs on schedule via GitHub Actions
- π¨ Customizable: Control number of badges and output format
- π Secure: Uses public data only, no authentication required
- π± Responsive: Works across different devices and platforms
Add these comments to your README.md
:
<!--START_SECTION:badges-->
<!--END_SECTION:badges-->
Create .github/workflows/update-badges.yml
:
name: Update Badges
on:
schedule:
# Runs daily at 2 AM UTC
- cron: "0 2 * * *"
workflow_dispatch: # Allow manual runs
jobs:
update-badges:
name: Update README with Credly Badges
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Update Badges
uses: pemtajo/badge-readme@main
with:
CREDLY_USER: ${{ github.actor }} # Uses your GitHub username
NUMBER_LAST_BADGES: 10 # Show last 10 badges (0 = all)
Go to your repository β Actions β "Update Badges" β "Run workflow"
That's it! Your badges will appear in your README automatically.
Parameter | Default | Description | Required |
---|---|---|---|
GH_TOKEN |
- | GitHub access token | Yes* |
REPOSITORY |
username/username |
Target repository | No |
CREDLY_USER |
username |
Your Credly username | No |
NUMBER_LAST_BADGES |
0 |
Number of badges to show (0 = all) | No |
COMMIT_MESSAGE |
Updated README with new badges |
Custom commit message | No |
*Only required for non-profile repositories
For your profile repository (username/username
), you don't need GH_TOKEN
:
- name: Update Badges
uses: pemtajo/badge-readme@main
For other repositories, add your GitHub token to repository secrets:
- name: Update Badges
uses: pemtajo/badge-readme@main
with:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
REPOSITORY: username/username
If you encounter ChromeDriver errors like "Status code was: 127", the setup has been improved with:
- webdriver-manager: Automatically downloads and manages compatible ChromeDriver versions
- Enhanced setup script: Better dependency management and error handling
- Environment detection: Automatically detects Docker vs regular system
- Test verification: ChromeDriver test script to verify setup
Run the test script to verify ChromeDriver:
python3 test_chromedriver.py
If issues persist, run the setup script:
chmod +x setup_chrome.sh
./setup_chrome.sh
- Permission errors: Ensure setup scripts are executable
- Network issues: Check internet connectivity for Chrome/ChromeDriver download
- Memory issues: Chrome headless mode uses significant memory
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Run setup:
./setup_chrome.sh
- Test ChromeDriver:
python3 test_chromedriver.py
- Run scraper:
python3 main.py
# Build and run with Docker
docker-compose up --build
# Or build manually
docker build -t credly-scraper .
docker run credly-scraper
# Run unit tests
python3 -m pytest tests/
# Run ChromeDriver test
python3 test_chromedriver.py
- uses: pemtajo/badge-readme@main
- uses: pemtajo/badge-readme@main
with:
CREDLY_USER: john_doe
NUMBER_LAST_BADGES: 5
COMMIT_MESSAGE: "π Updated with latest certifications"
from credly import generate_sorted_badges_markdown
# Generate badges for specific user
generate_sorted_badges_markdown(
username="your_credly_username",
number_badges=10,
output_file="my_badges.md"
)
We welcome contributions! This is an open-source project, and your help makes it better for everyone.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and add tests
- Run the test suite:
python -m unittest discover -v -s tests
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
# Clone the repository
git clone https://github.com/pemtajo/badge-readme.git
cd badge-readme
# Install dependencies
pip install -r requirements.txt
# Run tests
python -m unittest discover -v -s tests
- π Bug fixes and error handling improvements
- β¨ New features and enhancements
- π Documentation improvements
- π§ͺ Test coverage expansion
- Follow PEP 8 for Python code
- Add docstrings to new functions
- Include tests for new features
- Update documentation as needed
# Run all tests
python -m unittest discover -v -s tests
# Run specific test file
python -m unittest tests.tests -v
cd tests
docker-compose build && docker-compose up
Our test suite covers:
- β Core functionality - Badge extraction and parsing
- β Date handling - Extraction and sorting
- β HTML parsing - New Credly structure compatibility
- β Error handling - Edge cases and failures
- β File operations - Markdown generation and saving
- β Integration - End-to-end workflows
- Fetch HTML: Retrieves the Credly profile page
- Expand Badges: Clicks "See all badges" to load complete list
- Parse Structure: Extracts badge data using new HTML classes
- Extract Dates: Parses issue dates from Portuguese format
- Sort Badges: Orders by date (newest first)
- Generate Markdown: Creates clean, compatible output
- Update README: Commits changes to your repository
Old Structure (v2.x.x):
<div class="data-table-row">
<img class="badge-image" src="...">
</div>
New Structure (v3.0.0):
<div class="settings__skills-profile__edit-skills-profile__badge-card">
<img class="settings__skills-profile__edit-skills-profile__badge-card__badge-image" src="...">
<div class="settings__skills-profile__edit-skills-profile__badge-card__issued">
Issued 22/11/20
</div>
</div>
Dates are extracted from Portuguese format "Issued dd/mm/yy" and converted to sortable format:
- Input:
Issued 22/11/20
- Parsed:
2020-11-22
- Sorted: Newest first
- Selenium WebDriver integration for JavaScript-rendered content
- Individual badge links to specific verification pages
- HTML output format with explicit 80Γ80 pixel sizing
- Enhanced badge detection using multiple CSS selectors and fallbacks
- Automatic ChromeDriver management with
webdriver-manager
- Comprehensive error handling with fallback methods
- Output format switched from markdown images to HTML
<img>
tags for proper sizing - Badge link extraction from
div
elements withrole="button"
andhref
attributes - Performance optimizations for Chrome headless mode
- Documentation updated with new examples and troubleshooting
- Badge sizing issues β images now always render at 80 Γ 80 px
- JavaScript rendering β properly waits for dynamic badge content
- Deprecated
BADGE_SIZE
parameter (size now fixed at 80 Γ 80 px)
- Automatic badge expansion ("See all badges" button)
- Date-based sorting (newest first)
- Updated HTML parser for new Credly structure
- Direct file generation methods
- Comprehensive test suite
- Enhanced error handling
- Updated HTML class names and parsing logic
- Improved markdown format (removed href links)
- Better performance and reliability
- Enhanced documentation
CREDLY_SORT
parameter (no longer supported by Credly)BADGE_SIZE
parameter (no longer configurable)
- Basic badge extraction
- Configurable sorting and badge size
- Simple markdown generation
This project is licensed under the MIT License - see the LICENSE file for details.
- Credly for providing the badge platform
- GitHub Actions for the automation infrastructure
- Contributors who help improve this project
- Open Source Community for inspiration and support
Made with β€οΈ for the open-source community
If you find this project helpful, please consider giving it a β star!