Skip to content

Add action to generate and upload MCP-Eval badges from JSON report - #34

Merged
StreetLamb merged 13 commits into
mainfrom
add-badge-generation-action
Sep 6, 2025
Merged

Add action to generate and upload MCP-Eval badges from JSON report#34
StreetLamb merged 13 commits into
mainfrom
add-badge-generation-action

Conversation

@StreetLamb

Copy link
Copy Markdown
Contributor

Summary

  • Add a badge generation action and update workflow to use it.

Checklist

  • Tests added/updated
  • Docs updated (README, docs/*.mdx)
  • Lint passes locally
  • Linked issue (if any)

Screenshots / Logs

If applicable, add screenshots or logs.

Breaking Changes

  • Yes
  • No

If yes, describe the migration path.

@StreetLamb
StreetLamb requested a review from saqadri September 3, 2025 16:53

@saqadri saqadri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! How do we get the badge after running the action? Is there a way to have some link in a README that points to the badge, which would automatically be updated by the GitHub action?

@StreetLamb
StreetLamb force-pushed the add-badge-generation-action branch from 7c7a939 to 7db85ff Compare September 3, 2025 17:04
@StreetLamb

Copy link
Copy Markdown
Contributor Author

@saqadri In our workflow we can do something like:

...
- name: Generate badges
  uses: ./.github/actions/mcp-eval/badges
  with:
    report-path: ${{ steps.mcpeval.outputs.results-json-path }}
    output-dir: badges
    upload-artifacts: 'false'
# Update README badges to point to the correct paths
- name: Update README badges
  run: |
    # Ensure badges exist in README
    if ! grep -q "!\[mcp-tests\]" README.md; then
      # Add badges at the top of README if they don't exist
      sed -i '1a\\n![mcp-tests](badges/tests.svg)\n![mcp-cov](badges/coverage.svg)\n' README.md
    fi
# Commit badge files
- name: Commit changes
  run: |
    git config user.name "github-actions[bot]"
    git config user.email "github-actions[bot]@users.noreply.github.com"
    git add badges/*.svg README.md || true
    # Only commit if there are changes
    if ! git diff --cached --quiet; then
      git commit -m "chore(mcpeval): update badges"
      git push
    fi
  1. Badge generation action creates the badges in the output directory.
  2. Ensure readme reference the badges.
  3. Commits the updated badge svg files to the repo

@saqadri

saqadri commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

@saqadri In our workflow we can do something like:

...
- name: Generate badges
  uses: ./.github/actions/mcp-eval/badges
  with:
    report-path: ${{ steps.mcpeval.outputs.results-json-path }}
    output-dir: badges
    upload-artifacts: 'false'
# Update README badges to point to the correct paths
- name: Update README badges
  run: |
    # Ensure badges exist in README
    if ! grep -q "!\[mcp-tests\]" README.md; then
      # Add badges at the top of README if they don't exist
      sed -i '1a\\n![mcp-tests](badges/tests.svg)\n![mcp-cov](badges/coverage.svg)\n' README.md
    fi
# Commit badge files
- name: Commit changes
  run: |
    git config user.name "github-actions[bot]"
    git config user.email "github-actions[bot]@users.noreply.github.com"
    git add badges/*.svg README.md || true
    # Only commit if there are changes
    if ! git diff --cached --quiet; then
      git commit -m "chore(mcpeval): update badges"
      git push
    fi
  1. Badge generation action creates the badges in the output directory.
  2. Ensure readme reference the badges.
  3. Commits the updated badge svg files to the repo

@StreetLamb messaged async as well but in interest of building in the open -- we should follow the standard practice for badge generation to make them dynamic:
https://chatgpt.com/share/68b889f1-8df8-8011-8288-0539eca0fdb7

That would make it much simpler to have developers use them.
If we upload things to GH pages it makes it easier to see reports as well.

@StreetLamb
StreetLamb force-pushed the add-badge-generation-action branch from b714875 to 0b15ad5 Compare September 4, 2025 15:12
@StreetLamb
StreetLamb requested a review from saqadri September 4, 2025 15:16

@saqadri saqadri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Can you share what this would look like used by someone? i.e. what URL they should set in their badge to have it show up in a readme or some other place?

@StreetLamb

Copy link
Copy Markdown
Contributor Author

@saqadri Updated the ci/cd page to include info on how to create the workflow and use the badges. The mcpeval.yml workflow will trigger once this PR is merged which should start the test and update our github pages.

@saqadri

saqadri commented Sep 6, 2025

Copy link
Copy Markdown
Contributor

@StreetLamb awesome! Let's merge it and give it a spin

@StreetLamb
StreetLamb merged commit e26bd30 into main Sep 6, 2025
4 checks passed
@StreetLamb
StreetLamb deleted the add-badge-generation-action branch September 7, 2025 02:17
@StreetLamb

Copy link
Copy Markdown
Contributor Author

@saqadri Workflow working as expected!

@saqadri

saqadri commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

Awesome work @StreetLamb !

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.

2 participants