Skip to content

Conversation

@kpj2006
Copy link
Contributor

@kpj2006 kpj2006 commented Jan 31, 2026

Summary by CodeRabbit

  • Chores
    • Added an automated PR-labeling workflow that syncs labels from linked issues, tags PRs based on changed file types, assigns size-based change labels, and marks contributor experience.
    • Fixed contributor-tracking input so numeric change metrics are passed correctly.
    • Expanded contributor onboarding flow to run on PR open/close, calculate merged-change totals, and pass author/title/lines-changed to processing steps.

@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
PR Label Synchronization Workflow
.github/workflows/sync-pr-labels.yml
Adds a new workflow triggered on pull_request_target that: extracts linked-issue labels, maps changed files to category labels, computes and updates size/* labels, classifies contributors (maintainer / first-time / repeat), and logs final labels. Includes error handling and sequential steps.
Contributor Tracking Workflow
.github/workflows/track-contributor-prs.yml
Removes quotes around needs.calculate-changes.outputs.lines_changed so the value is passed as an expression instead of a string.
Contributor Onboarding Workflow
.github/workflows/contributor-onboarding.yml
Expands triggers to include PR opened/closed, adds repo write permission, introduces calculate-changes job to compute lines_changed, and updates process-response to use pull_request_target context and pass pr_author, pr_title, and lines_changed.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • fix " error #96: Modifies the same track-contributor-prs.yml handling of the lines_changed output (quote vs expression).
  • add workflow #68: Overlaps with changes to contributor-related workflows (track-contributor-prs.yml, contributor-onboarding.yml).

Suggested reviewers

  • Zahnentferner

Poem

🐰 I hopped through code with a twitchy nose,

I found issue links where the wild label grows,
Files and sizes I sorted with cheer,
First-time or repeat — I labeled them here,
A tiny hop to tidy PR rows 🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Push' is too vague and generic to meaningfully convey what changes are being made in this pull request. Provide a descriptive title that specifically summarizes the main changes, such as 'Add GitHub Actions workflows for PR label synchronization and contributor tracking' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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 unused pr-details step.

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
-            };

Copy link

@coderabbitai coderabbitai bot left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant