-
Notifications
You must be signed in to change notification settings - Fork 32
Push #101
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
base: main
Are you sure you want to change the base?
Push #101
Conversation
📝 WalkthroughWalkthroughAdds a new GitHub Actions workflow that synchronizes PR labels from linked issues, changed files, PR size, and contributor status; also tweaks two existing workflows (unquotes an outputs expression and expands contributor-onboarding triggers/gating). Changes
Sequence Diagram(s)sequenceDiagram
participant PR as PR Event
participant Runner as Actions Runner
participant API as GitHub API
participant Repo as Repository Labels
PR->>Runner: trigger on pull_request_target
Runner->>API: fetch PR body
API-->>Runner: PR body
Runner->>Runner: extract linked issue (regex)
alt issue found
Runner->>API: fetch issue labels
API-->>Runner: issue labels
Runner->>Repo: apply issue labels to PR
else no issue
Runner->>Repo: add `no-issue-linked` label
end
Runner->>API: list changed files
API-->>Runner: file list
Runner->>Repo: map files -> category labels and apply
Runner->>API: fetch additions/deletions
API-->>Runner: size metrics
Runner->>Repo: remove existing size/* labels
Runner->>Repo: add computed size label (size/XS..XL)
Runner->>API: check author collaborator permissions
API-->>Runner: permission status
alt maintainer
Runner->>Repo: add maintainer/org-Member label
else not maintainer
Runner->>API: fetch commit authors
API-->>Runner: commit history
Runner->>Repo: add `first-time-contributor` or `repeat-contributor`
end
Runner->>API: fetch current PR labels
API-->>Runner: labels
Runner->>Repo: log final label summary
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @.github/workflows/sync-pr-labels.yml:
- Around line 59-112: When applying issue-based labels (in the "Apply
issue-based labels" script that uses github.rest.issues.addLabels and checks
steps.extract-issue.outputs.issue_number), also remove the stale
'no-issue-linked' label from the PR: after successfully adding the issue labels,
call github.rest.issues.removeLabel (owner, repo, issue_number: prNumber, name:
'no-issue-linked') inside a try/catch and ignore 404s so it won't error if the
label is absent; this ensures the 'no-issue-linked' label is cleared when an
issue is later linked.
- Around line 114-133: The "Get changed files" step (id: changed-files)
currently calls github.rest.pulls.listFiles which only returns the first page
(30 files); update it to use github.paginate to fetch all pages (e.g., call
github.paginate with github.rest.pulls.listFiles and the same params) then
flatten/map the results to extract file.filename into changedFiles and set the
action output as before; ensure you still return changedFiles and set
core.setOutput('files', JSON.stringify(changedFiles)).
- Around line 262-320: Replace the commit-count-based contributor detection with
the webhook's ground-truth field by removing the listCommits call and using
context.payload.pull_request.author_association to decide labels: read
authorAssociation = context.payload.pull_request.author_association, map values
(e.g., "FIRST_TIME_CONTRIBUTOR" -> 'first-time-contributor', other non-member
associations -> 'repeat-contributor', and keep existing collaborator permission
check that sets 'org-Member' via permissionLevel.data.permission and
isMaintainer), then push contributorLabels (prNumber, contributorLabels) as
before; this eliminates the pagination/accuracy issues from commits and relies
on author_association for correct classification.
🧹 Nitpick comments (1)
.github/workflows/sync-pr-labels.yml (1)
17-29: Remove or use the unusedpr-detailsstep.Its outputs aren’t referenced later, so it’s dead weight unless you plan to consume it.
♻️ Suggested cleanup
- - name: Get PR details - id: pr-details - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const pr = context.payload.pull_request; - return { - number: pr.number, - body: pr.body || '', - base: pr.base.ref, - head: pr.head.ref - };
…st first-time contributors
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/contributor-onboarding.yml:
- Around line 18-21: You expanded the caller condition in
contributor-onboarding.yml to invoke StabilityNexus/ContributorAutomation for
every merged PR, so update the reusable workflow
(StabilityNexus/ContributorAutomation) to detect and gracefully skip repeat
contributors: add a lookup step at the top of the workflow that checks existing
records (e.g., a contributors database/file, repo metadata, or GitHub
issue/project) for the PR author and, if a discord_id/wallet is already stored,
short-circuit the workflow (no prompts or notifications) and log/return a no-op;
ensure the lookup references the same inputs or fields the workflow uses to
store data (discord_id, wallet, contributor username) and place the skip logic
before any interactive or external side-effect steps.
Summary by CodeRabbit