Repository navigation
chore(ci): require approved issues or vouchers for PRs #1917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
796d66f
chore(ci): require approved issues or vouchers for PRs
tinsever 77dd9b6
docs(ci): clarify eligibility checks during GitHub outages
tinsever 37ce548
fix(ci): recheck contribution eligibility when PRs close
tinsever 21f2123
fix(ci): batch linked issue eligibility lookups
tinsever 0f9c23a
fix(ci): exclude skipped events from eligibility concurrency
tinsever File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "vouchedContributors": [ | ||
| { | ||
| "id": 44305048, | ||
| "login": "andrejsshell", | ||
| "reason": "Core team (usekaneo/developers)." | ||
| }, | ||
| { | ||
| "id": 127273550, | ||
| "login": "randoneering", | ||
| "reason": "Core team (usekaneo/developers)." | ||
| }, | ||
| { | ||
| "id": 176929823, | ||
| "login": "tinsever", | ||
| "reason": "Core team (usekaneo/developers)." | ||
| } | ||
| ], | ||
| "exemptBots": [ | ||
| { | ||
| "id": 49699333, | ||
| "login": "dependabot[bot]", | ||
| "reason": "Repository-managed dependency updates." | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| name: Contribution eligibility | ||
|
|
||
| on: | ||
| # zizmor: ignore[dangerous-triggers] Only executes policy code from main; | ||
| # never checks out or executes pull-request content. | ||
| pull_request_target: | ||
| types: [opened, edited, synchronize, reopened, ready_for_review] | ||
| issues: | ||
| types: [labeled, unlabeled, closed, reopened, deleted, transferred] | ||
| label: | ||
| types: [edited, deleted] | ||
| # zizmor: ignore[dangerous-triggers] Reads GitHub metadata and trusted main | ||
| # code only; does not consume artifacts or code from the triggering run. | ||
| workflow_run: | ||
| workflows: [CI] | ||
| types: [completed] | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - .github/contribution-policy.json | ||
| - .github/workflows/contribution-eligibility.yml | ||
| - scripts/contribution-eligibility/** | ||
| # Manual sidebar links and permission changes have no matching Actions event. | ||
| schedule: | ||
| - cron: '17 * * * *' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| checks: write | ||
|
|
||
| concurrency: | ||
| group: contribution-eligibility | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| reconcile: | ||
| # Dependabot-triggered runs may receive a read-only token. CI completion | ||
| # rechecks its PR using a token issued in the trusted workflow context. | ||
| if: >- | ||
| (github.event_name != 'pull_request_target' || github.actor != 'dependabot[bot]') && | ||
| (github.event_name != 'workflow_run' || github.event.workflow_run.actor.login == 'dependabot[bot]') | ||
|
tinsever marked this conversation as resolved.
|
||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - name: Check out current trusted policy | ||
| uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1 | ||
| with: | ||
| # Always read the latest policy, including when an older run is queued. | ||
| ref: main | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 | ||
| with: | ||
| node-version: 24.19.0 | ||
| package-manager-cache: false | ||
|
|
||
| - name: Check open pull requests | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: node scripts/contribution-eligibility/check.mjs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { statusContext } from "./policy.mjs"; | ||
|
|
||
| export function checkPublisher(github) { | ||
| const ids = new Map(); | ||
| return async (sha, result) => { | ||
| const body = { | ||
| name: statusContext, | ||
| status: result.state === "pending" ? "in_progress" : "completed", | ||
| ...(result.state === "pending" | ||
| ? {} | ||
| : { conclusion: result.state === "success" ? "success" : "failure" }), | ||
| details_url: `https://github.com/${github.repository}/blob/main/CONTRIBUTING.md#contribution-eligibility`, | ||
| output: { | ||
| title: result.description, | ||
| summary: `${result.description}\n\n[Contribution rules](https://github.com/${github.repository}/blob/main/CONTRIBUTING.md#contribution-eligibility).`, | ||
| }, | ||
| }; | ||
| const id = ids.get(sha); | ||
| const check = await github.request( | ||
| `repos/${github.repository}/check-runs${id ? `/${id}` : ""}`, | ||
| { | ||
| method: id ? "PATCH" : "POST", | ||
| body: id ? body : { ...body, head_sha: sha }, | ||
| }, | ||
| ); | ||
| if (!Number.isSafeInteger(check.id) || check.id <= 0) { | ||
| throw new Error("GitHub did not return a check run ID."); | ||
| } | ||
| ids.set(sha, check.id); | ||
| }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.