-
-
Notifications
You must be signed in to change notification settings - Fork 19
Fix upstream Github response status change for creating a workflow dispatch event #318
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
Fix upstream Github response status change for creating a workflow dispatch event #318
Conversation
WalkthroughRelaxed WorkflowDispatch response validation to treat HTTP 200 or 204 as success; tests and error message updated to accept and reflect either status. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (3)
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. Comment |
|
@Codex- I think I have a fix in-place for the bug |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #318 +/- ##
=======================================
Coverage 91.72% 91.72%
=======================================
Files 7 7
Lines 266 266
Branches 66 66
=======================================
Hits 244 244
Misses 3 3
Partials 19 19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/api.spec.ts (1)
148-173: Update test name to reflect dual status code acceptance.The error messages on lines 163 and 170 correctly reflect that both 200 and 204 are now valid responses. However, the test name "should throw if a non-204 status is returned" is misleading since both 200 and 204 are now accepted.
🔎 Suggested fix for test name
- it("should throw if a non-204 status is returned", async () => { + it("should throw if a non-200/204 status is returned", async () => {
🧹 Nitpick comments (1)
src/api.spec.ts (1)
120-146: Add test coverage for HTTP 200 success response.Since the PR addresses GitHub's change to return HTTP 200 instead of 204, consider adding a test case that verifies HTTP 200 is accepted as a successful response alongside the existing 204 test.
🔎 Suggested additional test case
Add this test after the existing "should resolve after a successful dispatch" test:
it("should resolve after a successful dispatch with 200 status", async () => { vi.spyOn( mockOctokit.rest.actions, "createWorkflowDispatch", ).mockReturnValue( Promise.resolve({ data: undefined, status: 200, headers: {}, }), ); // Behaviour await expect(dispatchWorkflow("")).resolves.not.toThrow(); // Logging assertOnlyCalled(coreInfoLogMock); expect(coreInfoLogMock).toHaveBeenCalledOnce(); expect(coreInfoLogMock.mock.calls[0]?.[0]).toMatchInlineSnapshot(` "Successfully dispatched workflow: Repository: owner/repo Branch: ref Workflow: workflow Workflow Inputs: {"testInput":"test"} Distinct ID: " `); });
b910788 to
ad7463a
Compare
ad7463a to
4799d52
Compare
|
Thanks! |
Issue
Github recently updated their response code detailed here #317:
Fix
Update the allowed response codes from github.
I tested this with an internal repo and it was successful.
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.