Skip to content

feat: Integrate gh-velocity for automated project metrics#96

Merged
dvhthomas merged 8 commits intomainfrom
feat/gh-velocity-metrics
Mar 21, 2026
Merged

feat: Integrate gh-velocity for automated project metrics#96
dvhthomas merged 8 commits intomainfrom
feat/gh-velocity-metrics

Conversation

@dvhthomas
Copy link
Copy Markdown
Contributor

@dvhthomas dvhthomas commented Mar 21, 2026

Summary

  • Add four GitHub Actions workflows for automated velocity metrics using gh-velocity:
    • Weekly report (velocity-weekly.yml): Posts a Discussion every Monday at 09:00 UTC with 7-day project metrics
    • PR merge (velocity-pr.yml): Appends velocity metrics to PR body on merge, with idempotent sentinel markers
    • Issue close (velocity-issue.yml): Appends velocity metrics to issue body when closed as completed (skips "not planned")
    • Release (velocity-release.yml): Automatically posts release quality Discussion when a release is published
  • Configuration auto-generated via gh velocity config preflight --write
  • Removed all 6 legacy velocity bash scripts — fully replaced by gh-velocity
  • Updated /release command Step 9 to note release metrics are now automated
  • Updated SKILL.md and AGENTS.md to reference gh velocity commands

Key Design Decisions

  • Sentinel markers (<!-- gh-velocity-start/end -->) ensure idempotent body edits on workflow re-runs
  • Bot exclusion: dependabot PRs are excluded from metrics to avoid skewing averages
  • State reason guard: Issue workflow only fires for completed closures, not "not planned"
  • Preflight config: Used gh velocity config preflight --write for auto-generated, repo-aware configuration
  • Full removal of legacy scripts: No fallback needed since gh-velocity is the canonical tool
  • workflow_dispatch on all workflows for manual testing

Test plan

  • Run gh velocity config validate (already passing locally)
  • Trigger velocity-weekly.yml via workflow_dispatch and verify Discussion is created
  • Trigger velocity-release.yml via workflow_dispatch with a tag and verify Discussion
  • Merge a test PR and verify metrics are appended to PR body
  • Close an issue as completed and verify metrics are appended to issue body
  • Close an issue as "not planned" and verify no metrics are appended
  • Re-run a workflow and verify sentinel markers prevent duplication

Post-Deploy Monitoring & Validation

  • What to monitor: GitHub Actions workflow runs in the Actions tab
  • Validation checks: gh run list --workflow=velocity-weekly.yml --limit=1
  • Expected healthy behavior: Weekly Discussion posts appear, PR/issue bodies contain metrics blocks
  • Failure signal: Workflow runs with red status; missing metrics blocks on merged PRs
  • Validation window: First week after merge
  • Owner: Repo maintainer

Compound Engineering v2.47.0
🤖 Generated with Claude Opus 4.6 (1M context) via Claude Code

Metrics

Opened by @dvhthomas (agent-assisted) on 2026-03-21 14:38 UTC. Merged 2026-03-21 19:23 UTC.

Metric Value
Cycle Time 4h 44m (created -> merged)
Time to First Review n/a
Review Rounds 0

Generated by gh-velocity

How to interpret

Command: gh velocity pr --post

Setting Value
repository CalcMark/go-calcmark

dvhthomas and others added 8 commits March 21, 2026 08:38
Add three GitHub Actions workflows for velocity metrics:
- Weekly Discussion post with 7-day project metrics (Monday 09:00 UTC)
- PR merge metrics appended to PR body with idempotent sentinel markers
- Issue close metrics appended to issue body (skips "not planned")

Configuration generated via `gh velocity config preflight --write` with
quality categories, bot exclusion, and API throttle settings.

Update /release command Step 9 to use `gh velocity quality release`
with fallback to legacy release-velocity.sh script.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Delete all 6 custom velocity bash scripts (replaced by gh-velocity)
- Add velocity-release.yml workflow triggered on release publish
- Update SKILL.md to reference gh-velocity commands instead of scripts
- Update AGENTS.md to use `gh velocity issue` for metrics
- Update release.md Step 9 to note automation, remove legacy fallback
- Use preflight-generated .gh-velocity.yml config

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use file-based I/O (--body-file) instead of shell variable
  interpolation for PR/issue body content (prevents shell injection)
- Use env: mapping for all GitHub expression interpolation in run:
  blocks (prevents expression injection)
- Pin gh-velocity extension to v0.1.1 in all workflows
- Remove unnecessary fetch-depth: 0 from issue/pr workflows
- Fix METRICS_BLOCK indentation (was embedding YAML whitespace)
- Replace awk+grep sentinel editing with simpler sed approach
- Remove stale text from plan doc and SKILL.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Let gh-velocity CLI handle posting via --post flag:
- Bulk reports (report, quality release) post to Discussions
- Single-item commands (issue, pr) post as comments
- No sentinel markers, no body editing, no awk/sed needed
- Unpin extension version per user request

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
--post automatically selects markdown output format.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Picks up repo-configured issue types (Bug, Feature, Task) and
improved discussions config with template documentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Change discussion category from General to Announcements
- Remove manual fallback from /release Step 9 to prevent double-posting
  (velocity-release.yml workflow handles it automatically)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dvhthomas dvhthomas merged commit 61c4bd3 into main Mar 21, 2026
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.

1 participant