feat: add evidence-first contributor trust action - #1
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds 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. ChangesContributor trust action
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
dist/index.mjsis excluded by!**/dist/**
📒 Files selected for processing (8)
.github/workflows/test.yml.gitignoreREADME.mdaction.ymlpackage.jsonsrc/analyze.mjstest/analyze.test.mjstest/fixtures/pull_request.json
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 |
There was a problem hiding this comment.
| - uses: actions/checkout@v6 | |
| - uses: actions/checkout@v7 |
每个 action 都升级到最新版。
|
|
||
| on: | ||
| issues: | ||
| types: [opened] |
There was a problem hiding this comment.
| types: [opened] | |
| types: | |
| - opened |
尽量不用 JSON 兼容语法,而用 YAML 原生风格,阅读起来更清晰。
| github-token: | ||
| description: GitHub token with read access and permission to comment or label. | ||
| required: true | ||
| organization-token: | ||
| description: Optional organization token with Blocking users write permission. | ||
| required: false |
| block-high-confidence-automation: | ||
| description: Block high-confidence automated user accounts when an organization token is provided. | ||
| required: false | ||
| default: 'false' |
There was a problem hiding this comment.
| default: 'false' | |
| default: false |
布尔值用原生类型,不要用字符串。
| fail-on-high-risk: | ||
| description: Fail the workflow when the report is high risk. | ||
| required: false | ||
| default: 'false' |
| "type": "module", | ||
| "license": "LGPL-2.1-only", | ||
| "scripts": { | ||
| "test": "node --test" | ||
| }, | ||
| "engines": { | ||
| "node": ">=24" | ||
| } |
There was a problem hiding this comment.
| "type": "module", | |
| "license": "LGPL-2.1-only", | |
| "scripts": { | |
| "test": "node --test" | |
| }, | |
| "engines": { | |
| "node": ">=24" | |
| } | |
| "license": "LGPL-2.1-only", | |
| "type": "module", | |
| "engines": { | |
| "node": ">=24" | |
| }, | |
| "scripts": { | |
| "test": "node --test" | |
| } |
| function clamp(value, minimum, maximum) { | ||
| return Math.min(maximum, Math.max(minimum, value)); | ||
| } |
There was a problem hiding this comment.
| function clamp(value, minimum, maximum) { | |
| return Math.min(maximum, Math.max(minimum, value)); | |
| } | |
| const clamp = (value, minimum, maximum) => Math.min(maximum, Math.max(minimum, value)); |
返回语句前没有其它语句的时候,直接简化为箭头函数表达式。
| score = clamp(score, 0, 100); | ||
| return { |
There was a problem hiding this comment.
| score = clamp(score, 0, 100); | |
| return { | |
| score = clamp(score, 0, 100); | |
| return { |
逻辑代码和返回语句之间也要留有必要空格。
| if (!body.includes('<!-- contributor-trust:') || body.includes(ownMarker)) return false; | ||
| return /\*\*@[\w-]+:\s+(?:MEDIUM|HIGH)\s+\(\d+\/100\)\*\*/.test(body); |
There was a problem hiding this comment.
| 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); |
There was a problem hiding this comment.
测试文件改成 TypeScript 之后可以用 tsx 来执行。
Summary
Add a reusable JavaScript GitHub Action that builds an evidence-first contributor trust report for pull requests, issues, and issue comments.
needs-contributor-reviewfor medium/high risk.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.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
blockedoutput (along withauthor,risk-level,risk-score, andreport-json).