Skip to content

Conversation

Copy link

Copilot AI commented Oct 18, 2025

Overview

This PR implements v2 of the action, adding the ability to generate local SVG badge files and automatically commit them to the repository using the GitHub API. This addresses issues #23 and #24.

What's New in v2

🎨 Local SVG Badge Generation (Issue #23)

The action now uses the badge-maker package to generate SVG badges locally instead of relying on shields.io URLs. This provides:

  • Self-contained badges: All badges are stored as SVG files in your repository
  • No external dependencies: Badges render without requiring shields.io
  • Customizable storage: Configure where badge files are saved with badge_path input

Example badge format:

  • v1: ![Total repositories](https://img.shields.io/badge/Total%20repositories-341-blue?labelColor=555)
  • v2: ![Total repositories](./badges/total-repositories.svg)

🔄 Automated Commit & README Updates (Issue #24)

New optional features for automated workflow:

  • commit_badges: Automatically commit badge files to your repository using the GitHub REST API

    • Enables verified commits when using a GitHub App token
    • Eliminates need for manual git operations in workflows
  • update_readme: Automatically update your README.md with badge references

    • Updates content between <!-- start organization badges --> and <!-- end organization badges --> markers
    • Only updates if content has changed
    • Requires commit_badges: true

Simplified workflow example:

- uses: joshjohanning/organization-readme-badge-generator@v2
  with:
    organization: ${{ github.repository_owner }}
    token: ${{ steps.app-token.outputs.token }}
    commit_badges: true      # Auto-commit badge files
    update_readme: true       # Auto-update README

No more manual bash scripts for committing and updating!

New Input Parameters

Input Description Default
badge_path Path where badge SVG files should be saved badges
commit_badges Auto-commit badge files using GitHub API (verified commits) false
readme_path Path to README file to update profile/README.md
update_readme Auto-update README with badge references (requires commit_badges) false

Technical Changes

Dependencies Added

  • badge-maker@4.0.0 - SVG badge generation
  • @octokit/rest@21.0.2 - GitHub REST API operations

New Functions

  • generateBadgeSVG() - Creates SVG badges
  • saveBadgeSVG() - Saves SVG files to disk
  • getFileContent() - Retrieves file content via GitHub API
  • commitFile() - Creates/updates files via GitHub API
  • updateReadmeWithBadges() - Updates README between markers

Testing

  • Added 16 new test cases covering all new functionality
  • All 38 tests passing
  • Zero security vulnerabilities (CodeQL verified)

Breaking Changes ⚠️

This is a v2 release with breaking changes:

  • Badge output format changed from shields.io URLs to local SVG file references
  • Users upgrading from v1 should update their README to reference local badge files
  • Default behavior (with commit_badges: false) generates local files but doesn't commit them

Migration Guide

v1 to v2 (maintaining shields.io URLs): Use v1
v2 with manual commits: Use v2 with commit_badges: false (default)
v2 with automation: Use v2 with commit_badges: true and optionally update_readme: true

See the updated README for detailed usage examples.

Closes

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • img.shields.io
    • Triggering command: node /home/REDACTED/work/organization-readme-badge-generator/organization-readme-badge-generator/node_modules/.bin/make-coverage-badge-better --label-color #333 --output-path ./badges/coverage.svg (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Work on issues #23 and #24 as v2 of the action. This is the ability to generate svg badges to be able to save in the repo and the logic to atomically commit the badge. I guess we don't need the update text after all since it'll just refer to the svg in the repo.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits October 18, 2025 05:39
Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ability to generate SVG badges and commit logic feat: implement v2 with SVG badges and auto-commit functionality Oct 18, 2025
Copilot AI requested a review from joshjohanning October 18, 2025 05:54
Copilot finished work on behalf of joshjohanning October 18, 2025 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create option to automatically commit file to repo and update readme Use badge-maker and generate local SVGs we can save to repo

2 participants