-
-
Notifications
You must be signed in to change notification settings - Fork 39
feat: add a new optional GITLAB_COMMENT_CUSTOM_LINKS
env
#209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: e7ea1d5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThe changes introduce a new optional environment variable, Changes
Sequence Diagram(s)sequenceDiagram
participant CLI
participant CommentBot
participant Env
participant GitLab
CLI->>CommentBot: Request comment generation for merge request
CommentBot->>Env: Check for GITLAB_COMMENT_CUSTOM_LINKS
alt Custom Link Available
Env-->>CommentBot: Return custom link
CommentBot->>GitLab: Post comment with custom link
else No Custom Link
Env-->>CommentBot: Return undefined
CommentBot->>GitLab: Post comment with default link
end
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/comment.tsOops! Something went wrong! :( ESLint: 9.23.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.js src/types.tsOops! Something went wrong! :( ESLint: 9.23.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.js ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new optional environment variable GITLAB_COMMENT_CUSTOM_LINKS that allows users to override the default links in GitLab bot comments and updates the related documentation and code to use it.
- Added a new optional environment variable in the types definition.
- Updated comment generation logic to conditionally use the custom link and updated the fallback URL.
- Extended the documentation and changeset information to cover the new variable.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/types.ts | Added the new optional GITLAB_COMMENT_CUSTOM_LINKS environment var. |
src/comment.ts | Updated comment templates to conditionally use the custom links. |
README.md | Documented the new GITLAB_COMMENT_CUSTOM_LINKS environment variable. |
.changeset/short-queens-cover.md | Created changeset file describing the feature addition. |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
commit: |
📊 Package size report 0.3%↑
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
@codecov-ai-reviewer review |
On it! We are reviewing the PR and will provide feedback shortly. |
There was a problem hiding this comment.
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)
src/comment.ts (3)
79-84
: Consider enhancing implementation to preserve the addChangesetUrlThe current implementation completely replaces the default links when
GITLAB_COMMENT_CUSTOM_LINKS
is defined. This means any user providing a custom value will lose the dynamicaddChangesetUrl
link for adding a changeset to the MR.Consider modifying the implementation to allow users to include a placeholder for the dynamic URL:
${ env.GITLAB_COMMENT_CUSTOM_LINKS - || + ? env.GITLAB_COMMENT_CUSTOM_LINKS.replace('{{addChangesetUrl}}', addChangesetUrl) + : `[Click here to learn what changesets are, and how to add one](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md). [Click here if you're a maintainer who wants to add a changeset to this MR](${addChangesetUrl})` }
101-106
: Apply the same enhancement for consistencySimilar to the previous comment, this implementation completely replaces the default links when
GITLAB_COMMENT_CUSTOM_LINKS
is defined, losing the dynamicaddChangesetUrl
.Apply a similar enhancement for consistency:
${ env.GITLAB_COMMENT_CUSTOM_LINKS - || + ? env.GITLAB_COMMENT_CUSTOM_LINKS.replace('{{addChangesetUrl}}', addChangesetUrl) + : `Not sure what this means? [Click here to learn what changesets are](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md). [Click here if you're a maintainer who wants to add another changeset to this MR](${addChangesetUrl})` }
246-384
: Update the documentation to explain custom link formatIf implementing the suggested placeholder approach, it would be beneficial to update the README.md documentation to explain how to use the placeholder.
Consider expanding the documentation in README.md to specify how to use the variable:
-GITLAB_COMMENT_CUSTOM_LINKS # optional, override the links content referenced in the cli bot comment +GITLAB_COMMENT_CUSTOM_LINKS # optional, override the links content referenced in the cli bot comment. Use {{addChangesetUrl}} placeholder for the dynamic URL to add a changeset.This would make it clear how users should structure their custom links to preserve the dynamic URL functionality.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.changeset/short-queens-cover.md
(1 hunks)README.md
(1 hunks)src/comment.ts
(2 hunks)src/types.ts
(1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
src/comment.ts (1)
src/env.ts (1)
env
(10-33)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
.changeset/short-queens-cover.md (1)
1-5
: LGTM: Well-formed changeset fileThe changeset correctly indicates a minor version bump for the package "changesets-gitlab" and provides a clear description of the new feature.
README.md (1)
57-57
: LGTM: Clear documentation for the new environment variableThe documentation is concise and placed appropriately in the "Environment Variables" section.
src/types.ts (1)
26-26
: LGTM: Proper type definitionThe new environment variable is correctly added as an optional string property to the
Env
type, consistent with other environment variables in this interface.
PR from
main
branch is anti-pattern, #189 is closed accidentlySummary by CodeRabbit
New Features
Documentation