Skip to content

Conversation

@andrii-kl
Copy link
Contributor

  • Added a marker to tasks to correspond to the release number.
  • Implemented handling for negative scenarios to improve robustness and error management.
  • Added processing to handle task names in different cases (upper, lower, mixed).
  • Standardized output values to uppercase to avoid errors.

- Added a marker to tasks to correspond to the release number.
- Implemented handling for negative scenarios to improve robustness and error management.
- Added processing to handle task names in different cases (upper, lower, mixed).
- Standardized output values to uppercase to avoid errors.
@coderabbitai
Copy link

coderabbitai bot commented Apr 3, 2025

Summary by CodeRabbit

  • New Features
    • Implemented an automated process to update project management tasks after release completion.
    • Enhanced the release preparation workflow by capturing and uploading additional release task details.
    • Added validations to ensure essential dependencies are in place for smooth updates.
    • These improvements streamline the release process, providing increased reliability and visibility for end-users.

Walkthrough

The changes introduce a new GitHub Actions workflow that triggers on closed pull requests merging into the main branch from branches prefixed with release/v. The workflow downloads an artifact named release-tasks and executes a new script (linear_update.sh) to add release comments to corresponding Linear tasks via API calls. In addition, the release preparation workflow has been extended with a step to upload this artifact. Simultaneously, the changelog preparation script has been updated to extract release-related task IDs and write them into the .release_tasks file, which serves as the input for the Linear update process.

Changes

File(s) Change Summary
.github/workflows/linear-release-task-info-update.yml
.github/workflows/release-prepare.yml
Added a new workflow triggered on closed pull requests (with release branch conditions) to update Linear tasks. The release-prepare workflow now includes an "Upload release tasks artifact" step that uploads the .release_tasks artifact.
scripts/release/linear_update.sh New Bash script that validates inputs and dependencies, reads ticket IDs from .release_tasks, and posts comments to the Linear API for each task.
scripts/release/prepare_changelog.sh Extended to search for ticket identifiers in the changelog content and generate the .release_tasks file containing unique, uppercase task IDs.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub Actions
    participant AS as Artifact Storage
    participant LS as linear_update.sh
    participant API as Linear API

    %% Linear Task Update Workflow
    Dev->>GH: Merge PR on main (release/v branch)
    GH->>GH: Trigger linear-release-task-info-update workflow
    GH->>AS: Download "release-tasks" artifact
    GH->>LS: Execute linear_update.sh (pass LINEAR_API_KEY, release tag)
    loop For each ticket in .release_tasks
        LS->>API: POST release comment for ticket
        API-->>LS: Response (success or failure)
    end
    LS-->>GH: Completion status
Loading
sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub Actions
    participant PC as prepare_changelog.sh
    participant AS as Artifact Storage

    %% Release Preparation Flow
    Dev->>GH: Trigger release preparation workflow
    GH->>PC: Execute prepare_changelog.sh
    PC->>AS: Generate and store .release_tasks artifact
    GH->>AS: Upload "release-tasks" artifact for downstream use
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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 plan to trigger planning for file edits and PR creation.
  • @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.

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: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 94db274 and c9d98b3.

📒 Files selected for processing (4)
  • .github/workflows/linear-release-task-info-update.yml (1 hunks)
  • .github/workflows/release-prepare.yml (1 hunks)
  • scripts/release/linear_update.sh (1 hunks)
  • scripts/release/prepare_changelog.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
scripts/release/linear_update.sh

[info] 39-39: Double quote to prevent globbing and word splitting.

(SC2086)

scripts/release/prepare_changelog.sh

[info] 66-66: Use '[:lower:]' to support accents and foreign alphabets.

(SC2018)


[info] 66-66: Use '[:upper:]' to support accents and foreign alphabets.

(SC2019)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (2)
.github/workflows/release-prepare.yml (1)

119-124: Upload Release Tasks Artifact Step
The addition of the "Upload release tasks artifact" step correctly packages the newly created .release_tasks file as an artifact. This will support downstream processes (such as updating Linear tasks). The implementation looks clear and consistent with the overall workflow.

.github/workflows/linear-release-task-info-update.yml (1)

28-30: 💡 Verification agent

🧩 Analysis chain

Verify Release Tag Value for Linear Update
The workflow invokes ./scripts/release/linear_update.sh with the release tag value using ${{ github.event.release.tag_name }}. For pull request events, the release property typically isn’t populated. Please verify whether this is the intended behavior or if you should instead pass a value such as ${{ github.event.pull_request.head.ref }} to ensure that the script receives a valid release tag.


Based on the intended usage, please verify that the workflow is configured to trigger exclusively on release events. If the triggers are defined only under a release event (for example, on: release or on: release: [published]), then passing ${{ github.event.release.tag_name }} is entirely appropriate. However, if the workflow is ever triggered by pull request events, the release property would indeed be absent.

Actionable Note:

  • If the workflow is intended only for release events: No change is required. The release tag value is reliably set via ${{ github.event.release.tag_name }}.
  • If pull_request events are (or will be) used: Update the trigger configuration accordingly and consider passing an alternative reference (such as ${{ github.event.pull_request.head.ref }}) to ensure a valid value is received.

🏁 Script executed:

#!/bin/bash
# This script prints the trigger events configured in the workflow file to verify whether it runs on release events alone or if pull_request events are mixed in.
echo "Extracting trigger events from .github/workflows/linear-release-task-info-update.yml:"
awk '/^on:/{flag=1} flag{print} /^$/ {flag=0}' .github/workflows/linear-release-task-info-update.yml

Length of output: 519


Verify and Update Event Property for Linear Update
Our investigation shows that the workflow in .github/workflows/linear-release-task-info-update.yml is triggered on pull_request (closed) and workflow_dispatch events, meaning the release property (and thus ${{ github.event.release.tag_name }}) will not be populated during these events. Please confirm your intended behavior. If the update should run on release events, consider modifying the trigger configuration accordingly. Otherwise, if the workflow is meant to run on pull requests or manual triggers, update the argument to use a relevant property such as ${{ github.event.pull_request.head.ref }} to ensure that the script receives a valid value.

Comment on lines +65 to +67
# Generate file with list of tasks included this release
grep -o '[Mm][Tt][Gg]-[0-9]\{4\}' .changelog_content | sort -u | tr 'a-z' 'A-Z' > ".release_tasks"

Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Enhance Case Conversion Robustness
In this new segment, you correctly generate a list of release task IDs by filtering .changelog_content. To better support international characters and avoid potential mismatches with accented letters, consider replacing tr 'a-z' 'A-Z' with the POSIX-compliant tr '[:lower:]' '[:upper:]'.

Proposed Diff:

- grep -o '[Mm][Tt][Gg]-[0-9]\{4\}' .changelog_content | sort -u | tr 'a-z' 'A-Z' > ".release_tasks"
+ grep -o '[Mm][Tt][Gg]-[0-9]\{4\}' .changelog_content | sort -u | tr '[:lower:]' '[:upper:]' > ".release_tasks"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Generate file with list of tasks included this release
grep -o '[Mm][Tt][Gg]-[0-9]\{4\}' .changelog_content | sort -u | tr 'a-z' 'A-Z' > ".release_tasks"
# Generate file with list of tasks included this release
grep -o '[Mm][Tt][Gg]-[0-9]\{4\}' .changelog_content | sort -u | tr '[:lower:]' '[:upper:]' > ".release_tasks"
🧰 Tools
🪛 Shellcheck (0.10.0)

[info] 66-66: Use '[:lower:]' to support accents and foreign alphabets.

(SC2018)


[info] 66-66: Use '[:upper:]' to support accents and foreign alphabets.

(SC2019)

Comment on lines +38 to +40
--data '{
"query": "mutation { commentCreate(input: { issueId: \"'"$ISSUE_ID"'\", body: \"The task is part of the release v'$GITHUB_RELEASE_TAG' \" }) { success } }"
}')
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Improve JSON Payload Construction in curl Command
The current approach for constructing the JSON payload by directly injecting shell variables into the string can lead to word splitting or globbing issues (as highlighted by Shellcheck SC2086). For improved robustness and safety, consider using jq to build the JSON payload so the variables are properly escaped.

Proposed Diff:

-        --data '{
-          "query": "mutation { commentCreate(input: { issueId: \"'"$ISSUE_ID"'\", body: \"The task is part of the release v'$GITHUB_RELEASE_TAG' \" }) { success } }"
-        }'
+        --data "$(jq -n \
+              --arg issue "$ISSUE_ID" \
+              --arg tag "$GITHUB_RELEASE_TAG" \
+              '{ query: "mutation { commentCreate(input: { issueId: \"" + $issue + "\", body: \"The task is part of the release v" + $tag + " \" }) { success } }" }')"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
--data '{
"query": "mutation { commentCreate(input: { issueId: \"'"$ISSUE_ID"'\", body: \"The task is part of the release v'$GITHUB_RELEASE_TAG' \" }) { success } }"
}')
--data "$(jq -n \
--arg issue "$ISSUE_ID" \
--arg tag "$GITHUB_RELEASE_TAG" \
'{ query: "mutation { commentCreate(input: { issueId: \"" + $issue + "\", body: \"The task is part of the release v" + $tag + " \" }) { success } }" }')"
🧰 Tools
🪛 Shellcheck (0.10.0)

[info] 39-39: Double quote to prevent globbing and word splitting.

(SC2086)

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