Skip to content

Implement PR Size Labeler - #1098

Merged
Erik Osterman (Cloud Posse) (osterman) merged 6 commits into
mainfrom
DEV-3069
Feb 28, 2025
Merged

Erik Osterman (Cloud Posse) (osterman) merged 6 commits into
mainfrom
DEV-3069

Conversation

@Cerebrovinny

@Cerebrovinny Vinicius C. (Cerebrovinny) commented Feb 27, 2025 •

Copy link
Copy Markdown
Contributor

what

PR Size Labeler will run on every open pull request

why

This is required to defined the PR sizes

references

Summary by CodeRabbit

  • New Features
    • Introduced automated labeling for pull requests that categorizes submissions by size.
    • Now displays alerts for large changes, helping you manage and review contributions more effectively.

@mergify

mergify Bot commented Feb 27, 2025

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added triage Needs triage needs-cloudposse Needs Cloud Posse assistance labels Feb 27, 2025
@Cerebrovinny
Vinicius C. (Cerebrovinny) marked this pull request as ready for review February 27, 2025 22:07
@Cerebrovinny
Vinicius C. (Cerebrovinny) requested a review from a team as a code owner February 27, 2025 22:07
@coderabbitai

coderabbitai Bot commented Feb 27, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

A new job called pr-size-labeler has been introduced in the CodeQL GitHub Actions workflow within .github/workflows/codeql.yml. The job is configured to run on active, non-closed pull requests using an ubuntu-latest runner. It leverages the codelytv/pr-size-labeler@v1 action to automatically label pull requests based on predefined size thresholds, with a warning for extra large changes.

Changes

File Change Summary
.github/workflows/codeql.yml Added new pr-size-labeler job using codelytv/pr-size-labeler@v1 action, running on an ubuntu-latest runner for non-closed pull requests.

Sequence Diagram(s)

sequenceDiagram
    participant PR as Pull Request
    participant GH as GitHub Actions Workflow
    participant ACTION as codelytv/pr-size-labeler@v1

    PR ->> GH: PR opened (active)
    GH ->> ACTION: Execute pr-size-labeler job
    ACTION -->> GH: Return label result based on size thresholds
    GH ->> PR: Apply appropriate label and warning for extra large PRs
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/codeql.yml (1)

84-91: Clean Up Trailing Whitespace in Multiline Message

Static analysis identified trailing spaces on lines 88 and 90. Removing these trailing spaces will help maintain clean YAML formatting and avoid potential linting issues.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 88-88: trailing spaces

(trailing-spaces)


[error] 90-90: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31c811d and 48d5707.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/codeql.yml

[error] 88-88: trailing spaces

(trailing-spaces)


[error] 90-90: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Analyze (go)
  • GitHub Check: Summary
🔇 Additional comments (1)
.github/workflows/codeql.yml (1)

64-92: New PR Size Labeler Job Implementation and Configuration

The new job pr-size-labeler is well integrated into the workflow. It correctly limits execution to open pull requests by using the proper condition and runs on an Ubuntu runner. The size thresholds for XS, S, M, L, and the extra-large settings (with a warning message) are clearly defined and align with the PR objectives of categorizing PR sizes for smoother reviews.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 88-88: trailing spaces

(trailing-spaces)


[error] 90-90: trailing spaces

(trailing-spaces)

coderabbitai[bot]
coderabbitai Bot previously approved these changes Feb 27, 2025

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/workflows/codeql.yml (2)

64-107: New PR Size Labeler Job Addition
The configuration for the new PR Size Labeler job looks solid with clear threshold definitions and a thoughtful warning message. One suggestion: if the intent is to run this job only on open pull requests, consider refining the condition from

if: github.event_name == 'pull_request'

to something like

if: github.event.pull_request.state == 'open'

This would ensure the job skips closed pull requests.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 78-78: trailing spaces

(trailing-spaces)


[error] 103-103: trailing spaces

(trailing-spaces)


[error] 105-105: trailing spaces

(trailing-spaces)


78-78: Remove Trailing Whitespaces
YAML lint has flagged trailing spaces on lines 78, 103, and 105. Removing these will help maintain clean formatting.

Also applies to: 103-103, 105-105

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 78-78: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48d5707 and 6b8b32c.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/codeql.yml

[error] 78-78: trailing spaces

(trailing-spaces)


[error] 103-103: trailing spaces

(trailing-spaces)


[error] 105-105: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Analyze (go)
  • GitHub Check: Summary

coderabbitai[bot]
coderabbitai Bot previously approved these changes Feb 28, 2025

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

🧹 Nitpick comments (3)
.github/workflows/codeql.yml (3)

80-80: Remove Trailing Whitespace on Line 80

There's a trailing space at the end of the line that sets the ref parameter. Please remove the trailing whitespace to clean up the YAML formatting.

-          ref: ${{ github.event.pull_request.head.sha }} 
+          ref: ${{ github.event.pull_request.head.sha }}
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 80-80: trailing spaces

(trailing-spaces)


102-102: Remove Trailing Whitespace on Line 102

A trailing space exists at the end of this line in the multiline message. Removing it will improve the file's cleanliness.

-            > Large PRs are difficult to review and may be rejected due to their size.  
+            > Large PRs are difficult to review and may be rejected due to their size.
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 102-102: trailing spaces

(trailing-spaces)


104-104: Remove Trailing Whitespace on Line 104

This line of the warning message also has unwanted trailing whitespace. Please remove it to maintain a consistent format.

-            > Please verify that this PR does not address multiple issues.  
+            > Please verify that this PR does not address multiple issues.
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 104-104: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b8b32c and b52d631.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/codeql.yml

[error] 80-80: trailing spaces

(trailing-spaces)


[error] 102-102: trailing spaces

(trailing-spaces)


[error] 104-104: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Summary
🔇 Additional comments (1)
.github/workflows/codeql.yml (1)

65-105: New PR Size Labeler Job Integration Looks Solid

The new pr-size-labeler job is well-configured to run only for pull requests. The job correctly checks out the repository using the pull request head SHA and passes all anticipated inputs to the codelytv/pr-size-labeler@v1 action. The thresholds and labels are clear and meet the PR objectives for categorizing pull request sizes.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 80-80: trailing spaces

(trailing-spaces)


[error] 102-102: trailing spaces

(trailing-spaces)


[error] 104-104: trailing spaces

(trailing-spaces)

coderabbitai[bot]
coderabbitai Bot previously approved these changes Feb 28, 2025
Comment thread .github/workflows/codeql.yml Outdated
Comment thread .github/workflows/codeql.yml Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

🧹 Nitpick comments (3)
.github/workflows/codeql.yml (3)

75-80: Checkout Repository Step

The checkout step uses actions/checkout@v4 with a full history fetch (via fetch-depth: 0) and checks out the PR head commit. This ensures that the labeler operates on the correct code revision. Note: static analysis flagged trailing spaces on line 80; please remove them to comply with YAML lint guidelines.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 80-80: trailing spaces

(trailing-spaces)


105-105: Trailing Spaces in Warning Message

Static analysis detected trailing spaces on line 105 within the message_if_xl block. Please remove these trailing spaces to adhere to YAML linting conventions.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 105-105: trailing spaces

(trailing-spaces)


107-107: Trailing Spaces in Warning Message Continuation

Similarly, trailing spaces on line 107 need to be removed. Ensuring clean formatting here enhances maintainability and reduces linting errors.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 107-107: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b52d631 and d7c614e.

📒 Files selected for processing (1)
  • .github/workflows/codeql.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/codeql.yml

[error] 80-80: trailing spaces

(trailing-spaces)


[error] 105-105: trailing spaces

(trailing-spaces)


[error] 107-107: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Analyze (go)
  • GitHub Check: Summary
🔇 Additional comments (2)
.github/workflows/codeql.yml (2)

65-73: Job Definition for PR Size Labeler

The new job configuration for pr-size-labeler is well-defined. The condition if: github.event_name == 'pull_request' appropriately restricts this job to execute only on pull requests, and the permissions (contents: read, pull-requests: write, issues: write) are correctly set up.


81-109: PR Size Labeler Step Configuration

The step that invokes codelytv/pr-size-labeler@v1 is configured with comprehensive parameters. The thresholds for extra small through large PR sizes and the detailed warning message for extra large PRs are clearly laid out. The use of multi-line strings for both files_to_ignore and message_if_xl is consistent with earlier recommendations.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 105-105: trailing spaces

(trailing-spaces)


[error] 107-107: trailing spaces

(trailing-spaces)

@osterman Erik Osterman (Cloud Posse) (osterman) added the no-release Do not create a new release (wait for additional code changes) label Feb 28, 2025
@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Feb 28, 2025
Vinicius C. (Cerebrovinny) added a commit that referenced this pull request Mar 1, 2025
* added PR size labeler

* fix permissions

* fix permissions

* Apply suggestions from code review

---------

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
@github-actions

github-actions Bot commented Mar 1, 2025

Copy link
Copy Markdown

These changes were released in v1.165.0.

Erik Osterman (Cloud Posse) (osterman) added a commit that referenced this pull request Mar 2, 2025
* fix permissions

* codecov

* Implement PR Size Labeler (#1098)

* added PR size labeler

* fix permissions

* fix permissions

* Apply suggestions from code review

---------

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>

* Use Mergify for PR Size Comments (#1099)

* fix comment and line breaks

* comment test

* test changes

* this should not trigger another one

* fix multiple msg

* fix multiple msg

* remove test file

* Update .github/workflows/codeql.yml

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>

* add test file

* delete test file

---------

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>

* fix: coverage run

* clean up codecov

* fix path

* add comment

* add comment

* fix path debug

* fix path part 2

* test config cov

* test config cov

* test config cov

* test config cov

* test codecov config

* update ci

* Update codecov.yml

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>

* remove coverage file

* unify tests

* fix action codecov issue

* Update codecov.yml

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>

* Update .github/workflows/test.yml

* Update test.yml

* Update test.yml

* Update codecov.yml

---------

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants