-
Notifications
You must be signed in to change notification settings - Fork 177
Update Access Controls - SIMD-0007 #320
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
Open
Benhawkins18
wants to merge
13
commits into
solana-foundation:main
Choose a base branch
from
Benhawkins18:update-access-controls
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ad27f54
add github actions for jump and anza approval
Benhawkins18 a49858f
update approver list
Benhawkins18 d923564
update script to not redeclare script globals
Benhawkins18 7a97a8c
add debugging commands
Benhawkins18 ede0b6a
update script
Benhawkins18 dc0171b
add better error messaging
Benhawkins18 2b2cc39
improve error messaging
Benhawkins18 f2ad882
update SIMD-0007
Benhawkins18 0b076a9
update approvers
Benhawkins18 e338250
correct line lengths
Benhawkins18 900b4ed
Remove Jacob and Ben from error handling message
Benhawkins18 343433d
last clean up on SIMD-0007
Benhawkins18 edbc734
fix phillips github username
Benhawkins18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: Require Jump + Anza approval | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
- converted_to_draft | ||
pull_request_review: | ||
types: [submitted, dismissed, edited] | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Verify Jump + Anza approvals | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
// github, context, core are injected by github-script | ||
|
||
// ──────────── 1. MANUAL ROSTERS ──────────── | ||
const jumpApprovers = ['taffet-jump', 'topointon-jump', '0x0ece', 'lidatong', 'benhawkins18', 'jacobcreech']; | ||
const anzaApprovers = ['t-nelson', 'sakridge', 'bw-solana', 'benhawkins18', 'jacobcreech']; | ||
// ─────────────────────────────────────────── | ||
|
||
const pr = context.payload.pull_request; | ||
if (!pr) { core.setFailed('No pull_request context'); return; } | ||
|
||
// 2. fetch *all* reviews on this PR | ||
const { data: reviews } = await github.rest.pulls.listReviews({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: pr.number, | ||
per_page: 100 | ||
}); | ||
|
||
// DEBUG 1: raw events | ||
core.info('=== Raw review events ==='); | ||
reviews.forEach(r => | ||
core.info(`${r.user.login} -> ${r.state} @ ${r.submitted_at}`)); | ||
|
||
// 3. determine effective state per reviewer | ||
// We replay events chronologically so DISMISSED or REQUEST_CHANGES | ||
// can override an earlier APPROVED. | ||
reviews.sort((a, b) => new Date(a.submitted_at) - new Date(b.submitted_at)); | ||
|
||
const status = {}; // login → {approved, blocked} | ||
for (const r of reviews) { | ||
const u = r.user.login; | ||
status[u] = status[u] || { approved: false, blocked: false }; | ||
|
||
switch (r.state) { | ||
case 'APPROVED': | ||
status[u].approved = true; | ||
status[u].blocked = false; | ||
break; | ||
case 'REQUEST_CHANGES': | ||
status[u].approved = false; | ||
status[u].blocked = true; // blocks until new approval | ||
break; | ||
case 'DISMISSED': | ||
status[u].approved = false; // previous approval is now void | ||
break; | ||
default: | ||
// COMMENTED etc – ignore | ||
} | ||
} | ||
|
||
// DEBUG 2: effective map | ||
core.info('=== Effective state per reviewer ==='); | ||
Object.entries(status).forEach(([u, s]) => | ||
core.info(`${u}: approved=${s.approved}, blocked=${s.blocked}`)); | ||
|
||
// 4. final approved list (approved && not blocked) | ||
const approved = Object.entries(status) | ||
.filter(([_, s]) => s.approved && !s.blocked) | ||
.map(([u]) => u); | ||
|
||
core.info(`Approved reviewers counted: ${approved.join(', ') || 'none'}`); | ||
|
||
// 5. org-level checks | ||
const hasJump = jumpApprovers.some(u => approved.includes(u)); | ||
const hasAnza = anzaApprovers.some(u => approved.includes(u)); | ||
|
||
// helpful failure message | ||
const missingMsgs = []; | ||
if (!hasJump) | ||
missingMsgs.push(`Jump approval missing, need one of: ${jumpApprovers.join(', ')}`); | ||
if (!hasAnza) | ||
missingMsgs.push(`Anza approval missing, need one of: ${anzaApprovers.join(', ')}`); | ||
|
||
// PR-check summary | ||
core.summary | ||
.addHeading('Jump + Anza approval check') | ||
.addTable([ | ||
['Jump approval', hasJump ? '✅' : '❌'], | ||
['Anza approval', hasAnza ? '✅' : '❌'] | ||
]) | ||
.write(); | ||
|
||
if (missingMsgs.length) { | ||
core.setFailed(missingMsgs.join(' | ')); | ||
} else { | ||
core.notice('All required approvals present; merge allowed.'); | ||
} |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a single block from a group member should override all approvers from that group. Right now you could have a situation where a group member approves and another member of the same group requests changes and the result is that the group check passes.