-
Notifications
You must be signed in to change notification settings - Fork 5.5k
14859 components GitHub #14916
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
14859 components GitHub #14916
Conversation
Sources - New Workflow Run Completed (Instant) - New Run Job Completed (Instant) Actions - Create Workflow Dispatch - Enable Workflow - Disable Workflow - List Workflow Runs - Get Workflow Run
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
Warning Rate limit exceeded@luancazarine has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 51 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (44)
WalkthroughThe pull request introduces multiple new modules and functionalities related to GitHub workflows. Key additions include actions for creating, enabling, disabling, and retrieving workflow runs, as well as handling webhook events for workflow job completions. A new constant, Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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? 🪧 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.
Actionable comments posted: 11
🧹 Outside diff range and nitpick comments (11)
components/github/sources/new-workflow-job-completed/new-workflow-job-completed.mjs (2)
35-37
: Include Workflow Job Name in Event SummaryTo make the emitted event summary more informative, consider including the workflow job's name. This will help users quickly identify which job has completed.
You can modify the summary as follows:
this.$emit({ ...getRelevantHeaders(headers), ...body, }, { id: headers["x-github-delivery"], - summary: "New workflow job completed.", + summary: `Workflow job completed: ${body.workflow_job.name}`, ts: new Date(), });
43-43
: Enhance Clarity of Error MessageThe error message thrown when the user lacks admin access could be clearer. Consider rephrasing it to guide the user on how to proceed.
Update the error message as follows:
- throw new Error("Webhooks are only supported on repos where you have admin access."); + throw new Error("Admin access required: Please ensure you have admin permissions on the repository to create webhooks.");components/github/github.app.mjs (1)
762-772
: Consider Consistent Use of HTTP Client MethodsWhile most API requests use
this._client().request
, thecreateWorkflowDispatch
method usesthis._makeRequest
. For consistency and maintainability, consider usingthis._client().request
unless there's a specific reason to use_makeRequest
.Update the method as follows:
createWorkflowDispatch({ repoFullname, workflowId, ...opts }) { - return this._makeRequest({ - method: "POST", - path: `/repos/${repoFullname}/actions/workflows/${workflowId}/dispatches`, - ...opts, - }); + return this._client().request(`POST /repos/${repoFullname}/actions/workflows/${workflowId}/dispatches`, opts); }components/github/actions/common/constants.mjs (1)
9-13
: Organize Exported Constants for ClarityConsider organizing the exported constants alphabetically or logically grouped to enhance readability and maintainability.
Reorder the exports as follows:
const LIMIT = 100; const PULL_REQUEST_STATES = [ "APPROVED", "CHANGES_REQUESTED", "COMMENTED", "DISMISSED", "PENDING", ]; export default { + LIMIT, PULL_REQUEST_STATES, - LIMIT, };components/github/actions/enable-workflow/enable-workflow.mjs (1)
33-33
: Include Workflow Name in Success SummaryTo provide more informative feedback, consider including the workflow's name in the success summary after enabling it.
Modify the summary as follows:
$.export("$summary", `Successfully enabled the workflow with Id: ${this.workflowId}!`); + const { name } = await this.github.getWorkflow({ + repoFullname: this.repoFullname, + workflowId: this.workflowId, + }); + $.export("$summary", `Successfully enabled the workflow: ${name} (ID: ${this.workflowId})!`);components/github/actions/disable-workflow/disable-workflow.mjs (1)
38-40
: Enhance error handling specificityThe current error handling catches all errors and attempts to extract a message from the response. Consider handling specific error cases differently.
Consider this enhanced error handling:
- } catch (e) { - throw new ConfigurationError(e?.response?.data?.message); + } catch (error) { + if (error.response?.status === 404) { + throw new ConfigurationError(`Workflow with ID ${this.workflowId} not found`); + } + if (error.response?.status === 403) { + throw new ConfigurationError("Insufficient permissions to disable workflow"); + } + throw new ConfigurationError(error.response?.data?.message || "Failed to disable workflow"); }components/github/sources/new-workflow-run-completed/new-workflow-run-completed.mjs (2)
41-44
: Improve error message for admin permissionsThe error message could be more helpful by suggesting how to resolve the permission issue.
Consider this enhanced error message:
- throw new Error("Webhooks are only supported on repos where you have admin access."); + throw new Error( + "Webhooks require admin access to the repository. Please ensure you have admin " + + "permissions or contact the repository owner to grant you admin access." + );
31-38
: Use ISO timestamp formatFor consistency and proper timestamp handling, use ISO format for the timestamp.
this.$emit({ ...getRelevantHeaders(headers), ...body, }, { id: headers["x-github-delivery"], summary: "New workflow run completed.", - ts: new Date(), + ts: new Date().toISOString(), });components/github/actions/list-workflow-runs/list-workflow-runs.mjs (2)
6-6
: Consider removing API version from documentation linkThe documentation link includes a specific API version (
apiVersion=2022-11-28
). Consider removing this to ensure the link remains valid when the API version changes.
25-25
: Extract perPage as a constantThe
perPage
value should be extracted as a named constant at the module level for better maintainability.+const PER_PAGE = 100; + export default { // ... async run({ $ }) { let page = 1; - const perPage = 100; + const perPage = PER_PAGE;components/github/actions/create-workflow-dispatch/create-workflow-dispatch.mjs (1)
7-7
: Consider removing API version from documentation linkThe documentation link includes a specific API version (
apiVersion=2022-11-28
). Consider removing this to ensure the link remains valid when the API version changes.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (9)
components/github/actions/common/constants.mjs
(1 hunks)components/github/actions/create-workflow-dispatch/create-workflow-dispatch.mjs
(1 hunks)components/github/actions/disable-workflow/disable-workflow.mjs
(1 hunks)components/github/actions/enable-workflow/enable-workflow.mjs
(1 hunks)components/github/actions/get-workflow-run/get-workflow-run.mjs
(1 hunks)components/github/actions/list-workflow-runs/list-workflow-runs.mjs
(1 hunks)components/github/github.app.mjs
(3 hunks)components/github/sources/new-workflow-job-completed/new-workflow-job-completed.mjs
(1 hunks)components/github/sources/new-workflow-run-completed/new-workflow-run-completed.mjs
(1 hunks)
🔇 Additional comments (1)
components/github/github.app.mjs (1)
777-790
: 🛠️ Refactor suggestion
Handle API Response and Errors Appropriately
The disableWorkflow
and enableWorkflow
methods do not handle API responses or possible errors. Consider adding error handling or at least returning the API response for better transparency.
Modify the methods to return the response:
async disableWorkflow({
repoFullname,
workflowId,
}) {
- return this._makeRequest({
+ const response = await this._makeRequest({
method: "PUT",
path: `/repos/${repoFullname}/actions/workflows/${workflowId}/disable`,
});
+ return response;
}
async enableWorkflow({
repoFullname,
workflowId,
}) {
- return this._makeRequest({
+ const response = await this._makeRequest({
method: "PUT",
path: `/repos/${repoFullname}/actions/workflows/${workflowId}/enable`,
});
+ return response;
}
Likely invalid or redundant comment.
Resolves #14859
Summary by CodeRabbit
Release Notes
New Features
LIMIT
to manage workflow run retrieval limits.Bug Fixes
Documentation