Skip to content

add pr size label workflow - #40717

Merged
derrickaw merged 9 commits into
masterfrom
20261021_addPRSizeLabel
Oct 23, 2026
Merged

derrickaw merged 9 commits into
masterfrom
20261021_addPRSizeLabel

Conversation

@derrickaw

@derrickaw derrickaw commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator
  1. Add a PR size label so reviewers and users can see what size PRs are from the PR main page.
  2. Use a third-party library allowed by Apache infra to do the labeling.

@github-actions github-actions Bot added the build label Oct 22, 2026
@github-actions github-actions Bot added the size/m M: 50-249 lines changed label Oct 22, 2026
@derrickaw

Copy link
Copy Markdown
Collaborator Author

/gemini review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review Summary

This PR introduces a GitHub Actions workflow (pr-size-labeler.yml) that automatically calculates PR diff sizes (additions + deletions) and applies appropriate size/* labels. The workflow avoids checking out untrusted code on pull_request_target and passes workflow expressions safely via environment variables.

🔍 General Feedback

  • Calling gh label create five times on every PR event adds 5 unnecessary GitHub API requests per workflow run, which can contribute to GITHUB_TOKEN rate limit exhaustion on a high-traffic repository like Apache Beam.
  • Label matching uses grep -Fq without whole-line matching (-x), which can cause substring false positives if any prefix/suffix labels exist in the future.
  • Consider adding a concurrency group per PR so rapid pushes (synchronize events) do not race when adding and removing size labels.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

Comment thread .github/workflows/pr-size-labeler.yml Outdated
Comment thread .github/workflows/pr-size-labeler.yml Outdated
Comment thread .github/workflows/pr-size-labeler.yml Outdated
Comment thread .github/workflows/pr-size-labeler.yml Outdated
@derrickaw
derrickaw force-pushed the 20261021_addPRSizeLabel branch from a0e1f97 to 8790e8c Compare October 22, 2026 02:11
@derrickaw derrickaw changed the title add pr size label add pr size label workflow Oct 22, 2026
@derrickaw
derrickaw marked this pull request as ready for review October 22, 2026 02:25
@github-actions

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@derrickaw

Copy link
Copy Markdown
Collaborator Author

assign set of reviewers

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @damccorm for label build.
Backup reviewer: Amar3tto (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@damccorm

Copy link
Copy Markdown
Contributor

Haven't done a thorough review, but could you help me understand the goal here?

GitHub already renders the diff size directly above the labels, so I'm not sure how much info this adds

image

@derrickaw

derrickaw commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator Author

Haven't done a thorough review, but could you help me understand the goal here?

GitHub already renders the diff size directly above the labels, so I'm not sure how much info this adds

Other Github repos have this feature and when looking through the PRs from the main PR page you can quickly tell what size the PRs are and maybe review those first without clicking on PR to determine how large the changes are.

Its a small workflow with little maintenance, but with added benefit. Thanks

@Abacn

Abacn commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Thought about using a third party app, but then we have to get Apache Infra to approve

Have you checked if there is an existing Apache projects implementing PR sizes with third party Action? Ideally we can use one other than maintain our own; and we can put it into existing pr bot workflow (to just trigger one workflow per push)

Comment thread .github/workflows/label_prs.yml Fixed
@github-actions github-actions Bot added the size/xs XS: <10 lines changed label Oct 22, 2026
@github-actions github-actions Bot removed the size/m M: 50-249 lines changed label Oct 22, 2026
@derrickaw

Copy link
Copy Markdown
Collaborator Author

Thought about using a third party app, but then we have to get Apache Infra to approve

Have you checked if there is an existing Apache projects implementing PR sizes with third party Action? Ideally we can use one other than maintain our own; and we can put it into existing pr bot workflow (to just trigger one workflow per push)

Found another Apache project - mynewt - that uses a third party action. Updated to that. Thanks.

@damccorm

Copy link
Copy Markdown
Contributor

Haven't done a thorough review, but could you help me understand the goal here?
GitHub already renders the diff size directly above the labels, so I'm not sure how much info this adds

Other Github repos have this feature and when looking through the PRs from the main PR page you can quickly tell what size the PRs are and maybe review those first without clicking on PR to determine how large the changes are.

Its a small workflow with little maintenance, but with added benefit. Thanks

I'm fine adding this, particularly now that we've reafactored to use an external action. But the underlying principle I want us to be careful of is adding code that has limited value since code is a liability.

@derrickaw
derrickaw merged commit 0213fa8 into master Oct 23, 2026
8 checks passed
@derrickaw
derrickaw deleted the 20261021_addPRSizeLabel branch October 23, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants