Skip to content

feat: add AI code attribution workflow using git-ai - #138

Open
YairLeshemOctopus wants to merge 28 commits into
masterfrom
git-ai-init
Open

feat: add AI code attribution workflow using git-ai#138
YairLeshemOctopus wants to merge 28 commits into
masterfrom
git-ai-init

Conversation

@YairLeshemOctopus

Copy link
Copy Markdown

Summary

  • Adds a new GitHub Actions workflow that uses git-ai to check AI-written code percentage in PRs
  • Posts a visual comment on the PR showing human vs AI code attribution
  • Gracefully handles the case where no attribution data exists yet

Test plan

  • Verify the workflow triggers on this PR
  • Verify the "no data" fallback comment appears correctly
  • Verify comment is updated (not duplicated) on subsequent pushes

🤖 Generated with Claude Code

Adds a GitHub Actions workflow that checks AI-written code percentage
in PRs using git-ai and posts a visual comment with the results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@YairLeshemOctopus
YairLeshemOctopus requested a review from a team as a code owner March 22, 2026 13:00
@github-actions

github-actions Bot commented Mar 22, 2026

Copy link
Copy Markdown

🤖 AI Code Attribution

🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧🟧

Category Lines Percentage
🟦 Human 4 1%
🟧 AI-generated 306 99%
🟪 Mixed (AI + Human edits) 0 0%
Total 310

AI-accepted lines: 306 (committed without human modification)

Tool & model breakdown
Tool :: Model AI lines Mixed lines
claude::claude-opus-4-6 306 0

Powered by git-ai | Commit range: 45b20183c2ba9a3966edcdca2a0fa01c34390aa0..23daa8ffe899786d008989b7a219104bb8bdc1b7

YairLeshemOctopus and others added 15 commits March 22, 2026 15:04
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
git-ai stats returns different JSON structures for single commits
vs ranges. Range queries nest data under .range_stats.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Total was incorrectly using total_ai_additions (net metric) instead of
  ai_additions (actual line count)
- Replace empty text output with tool/model breakdown table from JSON

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace actions/checkout with manual git clone and run all steps
inside quay.io/codefresh/curl container. No external action dependencies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previously mixed_pct was computed as remainder (100 - human - ai),
which attributed rounding errors to mixed even when mixed was 0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…t-ai

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The container user differs from the checkout user, causing git to
reject operations with 'dubious ownership'. This silently broke
the notes fetch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New workflow triggers on push to test-git-ai branch, runs cumulative
git-ai stats, and updates README between marker comments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the docs label Mar 22, 2026
YairLeshemOctopus and others added 10 commits March 22, 2026 18:04
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The empty tree SHA doesn't work with git-ai. Use git rev-list to
find the actual first commit dynamically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…repo

Replace inline workflow logic with thin callers that reference
codefresh-io/shared-github-workflows reusable workflows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant