Skip to content

feat: add evidence-first contributor trust action - #1

Merged
TechQuery merged 5 commits into
Open-Source-Bazaar:mainfrom
Neroxsh:feat/evidence-first-report
Aug 31, 2026
Merged

TechQuery merged 5 commits into
Open-Source-Bazaar:mainfrom
Neroxsh:feat/evidence-first-report

Conversation

@Neroxsh

@Neroxsh Neroxsh commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a reusable JavaScript GitHub Action that builds an evidence-first contributor trust report for pull requests, issues, and issue comments.

  • Reads public GitHub profile, account age, recent public activity, public Issue/PR history, and earlier PRs in the current organization.
  • Optionally asks GitHub Models for a second opinion grounded only in the collected evidence.
  • Creates or updates one idempotent report comment and applies needs-contributor-review for medium/high risk.
  • Never blocks an account automatically; maintainers keep the final decision.
  • Uses no third-party runtime dependencies and never checks out or executes external PR code.
  • Exposes author, risk level, score, and a machine-readable JSON report as outputs.

Related task: Open-Source-Bazaar/Open-Source-Bazaar.github.io#89

Verification

  • node --test: 5 tests passed.
  • node --check dist/index.mjs: passed.
  • node --check src/analyze.mjs: passed.
  • Read-only smoke test against the real GitHub API: passed.
  • git diff --check: passed.

AI usage

Codex assisted with research, implementation, and testing. API permissions, external-PR safety boundaries, idempotent label/comment behavior, and score thresholds were reviewed, and the submitted result remains the contributor's responsibility.

Summary by CodeRabbit

  • New Features
    • Added the Contributor Detection GitHub Action with configurable AI review, optional commenting, and high-risk failure behavior.
    • Introduced organization-blocking controls and a new blocked output (along with author, risk-level, risk-score, and report-json).
  • Documentation
    • Expanded README with detailed usage, required permissions, safety boundaries, and output descriptions.
  • Bug Fixes
    • Improved review label retention/clearing and refined automated contributor blocking behavior.
  • Tests
    • Added unit tests covering scoring, AI confidence gating, blocking decisions, and label handling.
  • Chores
    • Added a CI “Test” workflow and updated build artifact ignore rules.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dcf26926-a149-439d-b7b0-3f5d13101bee

📥 Commits

Reviewing files that changed from the base of the PR and between 99b23cd and 6504b51.

⛔ Files ignored due to path filters (1)
  • dist/index.mjs is excluded by !**/dist/**
📒 Files selected for processing (4)
  • README.md
  • action.yml
  • src/analyze.mjs
  • test/analyze.test.mjs
🚧 Files skipped from review as they are similar to previous changes (2)
  • README.md
  • test/analyze.test.mjs

📝 Walkthrough

Walkthrough

Adds a Node 24 GitHub Action definition, contributor risk scoring and enforcement policies, AI-review merging, label retention logic, documentation, project metadata, unit tests, a pull request fixture, and CI execution for pushes and pull requests.

Changes

Contributor trust action

Layer / File(s) Summary
Action contract and runtime
action.yml, package.json, .gitignore, README.md, .github/workflows/test.yml
Defines action inputs, outputs, Node 24 execution, project metadata, distribution tracking, usage instructions, output documentation, and automated test execution.
Contributor scoring and enforcement
src/analyze.mjs
Scores contributors using profile and activity signals, bypasses scoring for trusted associations, builds report facts, merges confidence-gated AI adjustments, retains review labels, and determines high-confidence automated-account blocking.
Analysis validation and fixtures
test/analyze.test.mjs, test/fixtures/pull_request.json
Tests scoring, trusted and bot-like cases, AI-review confidence handling, blocking policy, review-label retention, and adds a pull request fixture.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding an evidence-first contributor trust GitHub Action.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test.yml:
- Line 14: Update the actions/checkout step to disable credential persistence by
setting its persist-credentials input to false. Keep the existing checkout
action and workflow behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e05a42ad-76e1-4204-b288-ffa81c3e95ed

📥 Commits

Reviewing files that changed from the base of the PR and between f3465cc and 262b8b5.

⛔ Files ignored due to path filters (1)
  • dist/index.mjs is excluded by !**/dist/**
📒 Files selected for processing (8)
  • .github/workflows/test.yml
  • .gitignore
  • README.md
  • action.yml
  • package.json
  • src/analyze.mjs
  • test/analyze.test.mjs
  • test/fixtures/pull_request.json

Comment thread .github/workflows/test.yml Resolved
Comment thread .github/workflows/test.yml Resolved
Comment thread README.md Resolved
Comment thread action.yml Resolved
Comment thread action.yml Resolved
Comment thread action.yml
Comment on lines +28 to +31
fail-on-high-risk:
description: Fail the workflow when the report is high risk.
required: false
default: 'false'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

高风险不是应该报告吗?为什么要失败?

Comment thread package.json Resolved
Comment thread src/analyze.mjs Resolved
Comment thread src/analyze.mjs
Comment on lines +88 to +89
score = clamp(score, 0, 100);
return {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
score = clamp(score, 0, 100);
return {
score = clamp(score, 0, 100);
return {

逻辑代码和返回语句之间也要留有必要空格。

Comment thread src/analyze.mjs
Comment on lines +120 to +121
if (!body.includes('<!-- contributor-trust:') || body.includes(ownMarker)) return false;
return /\*\*@[\w-]+:\s+(?:MEDIUM|HIGH)\s+\(\d+\/100\)\*\*/.test(body);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (!body.includes('<!-- contributor-trust:') || body.includes(ownMarker)) return false;
return /\*\*@[\w-]+:\s+(?:MEDIUM|HIGH)\s+\(\d+\/100\)\*\*/.test(body);
return body.includes('<!-- contributor-trust:')
&& !body.includes(ownMarker)
&& /\*\*@[\w-]+:\s+(?:MEDIUM|HIGH)\s+\(\d+\/100\)\*\*/.test(body);

Comment thread test/analyze.test.mjs Resolved
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in 开源项目 Jul 25, 2026
@TechQuery
TechQuery merged commit 8fe9c25 into Open-Source-Bazaar:main Aug 31, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in 开源项目 Aug 31, 2026
Copilot AI added a commit that referenced this pull request Aug 31, 2026
…ew changes

Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants