Skip to content

chore(wren-ui): add github workflow PR tagger - #1402

Merged
onlyjackfrost merged 3 commits into
mainfrom
chore/workflow-tagger
Mar 18, 2025
Merged

onlyjackfrost merged 3 commits into
mainfrom
chore/workflow-tagger

Conversation

@onlyjackfrost

@onlyjackfrost onlyjackfrost commented Mar 13, 2025 •

Copy link
Copy Markdown
Contributor

Desciption

PR Tagging Logic Summary
🏷 Labeling based on changed files:

  • If any file in wren-ui/src/ is changed → Add wren-ui label
  • If any file in deployment/ is changed → Add deployment label
  • If any file in wren-launcher/ is changed → Add launcher label
  • If any file in wren-ai-service/ is changed → Add wren-ai-service label
  • If any file in docker/ contains .example → Add ai-env-changed label
  • If the file wren-ui/src/apollo/server/config.ts is changed → Add ui-env-changed label

📌 Labeling based on PR title:
We can better identify the PR would be merged in what version.

  • If PR title contains a milestone format (milestone: XYZ), then:
  • Add XYZ as a label

📝 Updating PR Title with Environment Changes:
This can help us identify which commit has to update envs when deploying.

  • If the ai-env-changed label is added but not present in the PR title, append (ai-env-changed) to the title
  • If the ui-env-changed label is added but not present in the PR title, append (ui-env-changed) to the title

Screenshot

image

Summary by CodeRabbit

  • Chores
    • Introduced an automated labeling workflow that analyzes pull request changes and identifies milestones in titles to apply appropriate tags. This enhancement streamlines pull request organization and ensures that changes across various project areas are clearly categorized for easier review.

@coderabbitai

coderabbitai Bot commented Mar 13, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

A new GitHub Actions workflow named PR Tagger has been added. It triggers on pull request events such as opened, synchronized, and reopened, and operates by checking out the repository, retrieving changed files, and analyzing file paths and pull request titles to determine appropriate labels. Specific directories are monitored, and labels such as ai-env-changed and ui-env-changed are conditionally applied. The workflow also extracts a milestone from the PR title and updates the pull request accordingly, logging the actions taken.

Changes

File(s) Change Summary
.github/workflows/pr-tagger.yaml New GitHub Actions workflow that tags PRs by analyzing changed files in specific directories, adds milestone labels via PR title regex matching, and updates the PR accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant PR as "Pull Request"
    participant Workflow as "PR Tagger Workflow"
    participant Checkout as "Checkout Step"
    participant Analyzer as "File Analyzer"
    participant Updater as "PR Updater"

    PR->>Workflow: Trigger event (opened, synchronized, reopened)
    Workflow->>Checkout: Check out repository
    Checkout-->>Workflow: Repository code
    Workflow->>Analyzer: Retrieve changed files & PR title
    Analyzer-->>Workflow: Determine applicable labels (e.g., `ai-env-changed`, `ui-env-changed`, milestone)
    Workflow->>Updater: Update PR title and add labels
    Updater-->>PR: PR updated with new labels
Loading

Suggested labels

module/ui

Suggested reviewers

  • wwwy3y3

Poem

I'm a rabbit with a coding cheer,
Hopping through workflows without any fear.
Files get tagged with a magical surprise,
PRs updated before your eyes.
In this code garden, our fix is clear! 🐰
Happy hops to all, let’s give a cheer!

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

🪧 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 to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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 (5)
.github/workflows/pr-tagger.yaml (5)

19-24: Checkout Step – Consider Upgrading the Action Version
The checkout step is implemented correctly; however, static analysis suggests that actions/checkout@v3 may be outdated. It is recommended to update to a more recent version (for example, actions/[email protected]) to benefit from the latest features and fixes.

-        uses: actions/checkout@v3
+        uses: actions/[email protected]
🧰 Tools
🪛 actionlint (1.7.4)

21-21: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


29-33: GitHub Script Action – Upgrade Recommended
The labeling step employs actions/github-script@v6, which may be outdated. Updating this action (e.g., to actions/[email protected]) could improve reliability and performance.

-        uses: actions/github-script@v6
+        uses: actions/[email protected]
🧰 Tools
🪛 actionlint (1.7.4)

30-30: the runner of "actions/github-script@v6" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


37-54: Label Assignment Logic Aligns with PR Objectives
The loop correctly assigns labels based on file path checks for the specified directories and file patterns.

Note: Static analysis detected trailing spaces on lines 47 and 49. Removing these will help maintain a clean code style.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 47-47: trailing spaces

(trailing-spaces)


[error] 49-49: trailing spaces

(trailing-spaces)


81-93: Dynamic Update of PR Title for "ui-env-changed" is Consistent
Like the previous block, this section suitably updates the PR title with "(ui-env-changed)" if required. The duplication of logic here is acceptable given the clarity; however, consider abstracting similar title-update logic into a common function for improved maintainability in the future.


95-106: Final Label Application Completes the Workflow
The final block handles the addition of labels to the pull request and logs the applied changes. It also adequately handles the scenario when no matching conditions are met.

Note: Static analysis also flagged trailing spaces on line 102. Please remove these trailing spaces to conform with styling guidelines.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 102-102: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c4a520 and 29ab36a.

📒 Files selected for processing (1)
  • .github/workflows/pr-tagger.yaml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/pr-tagger.yaml

21-21: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


30-30: the runner of "actions/github-script@v6" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)
.github/workflows/pr-tagger.yaml

[error] 47-47: trailing spaces

(trailing-spaces)


[error] 49-49: trailing spaces

(trailing-spaces)


[error] 102-102: trailing spaces

(trailing-spaces)

🔇 Additional comments (7)
.github/workflows/pr-tagger.yaml (7)

1-2: Workflow Name Declaration is Clear
The workflow is clearly named "PR Tagger," which immediately conveys its purpose.


3-12: PR Trigger Conditions Configured Correctly
The on section properly listens for pull request events (opened, synchronize, reopened) and restricts file changes to the specified directories, aligning well with the PR objectives.


13-18: Job Setup and Permission Settings are Appropriate
The job definition under jobs and the permissions (with pull-requests: write) are configured correctly to allow the workflow to update PR titles and add labels.


25-28: Changed Files Step is Configured Correctly
The step using tj-actions/changed-files@v35 appears to be correctly set up for retrieving the list of changed files.


34-36: Changed Files Parsing is Straightforward
The script splits the changed files string and initializes a set of labels in a clear and simple manner, satisfying the basic requirements.


56-67: Milestone Extraction is Implemented Well
The regex correctly extracts the milestone from the PR title, and the subsequent logic appropriately adds the milestone as a label. Consider, in the future, handling cases with multiple milestone patterns if needed.


68-80: Dynamic Update of PR Title for "ai-env-changed" Works as Intended
The script updates the PR title by appending "(ai-env-changed)" when necessary. This meets the intended requirements for reflecting environment changes directly in the title.

@onlyjackfrost
onlyjackfrost force-pushed the chore/workflow-tagger branch from 8a5038c to 9ce259b Compare March 13, 2025 08:03

@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/pr-tagger.yaml (3)

58-60: Minor Formatting: Trailing Spaces
Trailing whitespace is detected at lines 58 and 60. Please remove the extraneous spaces to comply with YAML formatting standards.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 58-58: trailing spaces

(trailing-spaces)


[error] 60-60: trailing spaces

(trailing-spaces)


135-135: Formatting: Remove Trailing Space
A trailing space is detected on this line. Please remove it to adhere to YAML linting guidelines.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 135-135: trailing spaces

(trailing-spaces)


143-143: Formatting: Remove Trailing Space
Trailing whitespace is also present on this line. Removing these extraneous spaces will help keep the file tidy.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 143-143: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 29ab36a and 9ce259b.

📒 Files selected for processing (1)
  • .github/workflows/pr-tagger.yaml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/pr-tagger.yaml

21-21: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


30-30: the runner of "actions/github-script@v6" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.35.1)
.github/workflows/pr-tagger.yaml

[error] 58-58: trailing spaces

(trailing-spaces)


[error] 60-60: trailing spaces

(trailing-spaces)


[error] 135-135: trailing spaces

(trailing-spaces)


[error] 143-143: trailing spaces

(trailing-spaces)

🔇 Additional comments (14)
.github/workflows/pr-tagger.yaml (14)

1-2: New Workflow Declaration
The workflow name "PR Tagger" is clearly declared and descriptive.


3-11: Workflow Triggers and Path Filters
The pull_request event is set up with the proper types and path filters to capture changes in the designated directories.


13-19: Job Configuration and Permissions
The job is correctly configured to run on ubuntu-latest and has the necessary pull-requests: write permission for updating PRs.


25-27: Changed Files Action
Using tj-actions/changed-files@v35 is appropriate here and should reliably capture the list of changed files.


34-35: Script Initialization
The initialization of changedFiles and labels is succinct and straightforward.


37-45: Label Colors Declaration
The labelColors object is well-defined, with clear commentary on the color associations. This aids maintainability and clarity.


47-64: Directory Checks and Labeling Logic
The loop efficiently checks if changed files belong to specific directories to add the appropriate labels. The use of startsWith for path matching is effective.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 58-58: trailing spaces

(trailing-spaces)


[error] 60-60: trailing spaces

(trailing-spaces)


66-75: Milestone Extraction Logic
The regex-based extraction of the milestone from the PR title is implemented correctly, allowing dynamic labeling based on title content.


77-89: Title Update for "ai-env-changed"
The logic to append "(ai-env-changed)" to the PR title (when not already present) is clear and functions as intended.


90-101: Title Update for "ui-env-changed"
Similarly, the conditional check to add "(ui-env-changed)" to the PR title is correctly implemented.


103-132: Label Creation/Update Process
The try-catch approach for creating labels and updating their colors is robust. This ensures that the workflow gracefully handles cases where labels may already exist.


133-142: Adding Labels to the PR
The step that adds the accumulated set of labels to the pull request is clear and includes logging for better traceability.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 135-135: trailing spaces

(trailing-spaces)


20-24:

Details

❓ Verification inconclusive

Action Version Update for Checkout
The checkout step uses actions/checkout@v3. However, static analysis indicates this version might be outdated. Consider updating to a newer version (e.g., actions/checkout@v4 if available) to ensure compatibility and benefit from recent improvements.


I'll start by gathering additional information regarding whether a stable release for actions/checkout@v4 exists and if it's recommended over v3. This will help validate the review comment's suggestion.

Is there a stable release for "actions/checkout@v4" available, and is it recommended over "actions/checkout@v3" in GitHub workflows as of March 2025? Please provide relevant release note details.

Once we get the results from this query, we can decide if the suggested update is warranted.

🧰 Tools
🪛 actionlint (1.7.4)

21-21: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


29-33:

Details

❓ Verification inconclusive

Action Version Update for GitHub Script
This step utilizes actions/github-script@v6. Similar to the checkout action, consider updating to a more recent version to take advantage of any improvements or fixes.


Based on the retrieved file snippet, the workflow still pins the GitHub Script action to actions/github-script@v6. While this version is valid, it’s worth verifying whether a newer release (for example, a potential update such as v6.3.0) is available to benefit from the latest improvements and fixes. Please consult the official actions/github-script repository to check for the most recent stable version and update accordingly.

Action Version Update Recommendation:

  • Verify if a more recent version than v6 is available (e.g., by checking the official repo releases).
  • If so, update this step in .github/workflows/pr-tagger.yaml to the latest version.

🏁 Script executed:

#!/bin/bash
# Check for the usage of the GitHub Script action in the workflow file
grep 'actions/github-script' .github/workflows/pr-tagger.yaml

Length of output: 100


Update GitHub Script Action Version

I verified that the workflow in .github/workflows/pr-tagger.yaml is using actions/github-script@v6. Please check the actions/github-script repository for the latest stable release. If a newer version is available, update the workflow step to reference it in order to benefit from recent improvements and fixes.

  • Location: .github/workflows/pr-tagger.yaml (Lines 29–33)
🧰 Tools
🪛 actionlint (1.7.4)

30-30: the runner of "actions/github-script@v6" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

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.

2 participants