-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ci: fix automerge for humans #3917
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
WalkthroughThis change updates a GitHub Actions workflow by adding enhanced error handling and logic modifications. The workflow now checks for an empty commit list and sets an appropriate failure message when no commits or authors are found. It extracts unique authors from the commits—mapping usernames to their names and emails—and returns this object for subsequent steps. The modifications also adjust the subsequent check to base its logic on the count of author keys instead of commit count. Changes
Sequence Diagram(s)sequenceDiagram
participant W as Workflow
participant C as Commits List
participant A as Authors Extraction
W->>C: Retrieve commits from PR
alt No commits
C-->>W: Empty list
W->>W: Set failure "No commits found"
else Commits exist
C-->>W: Non-empty list
W->>A: Extract unique authors (username, name, email)
A-->>W: Return authors object
alt No authors
W->>W: Set failure "No authors found"
else Authors found
W->>W: Proceed with co-authored message logic
end
end
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
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. 🪧 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
Documentation and Community
|
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3917 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 667 667
Branches 113 113
=========================================
Hits 667 667 ☔ 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
🔭 Outside diff range comments (1)
.github/workflows/automerge-for-humans-merging.yml (1)
98-98: 💡 Verification agent🧩 Analysis chain
Review JSON Parsing of Commit Message
The merge commit message is constructed using
fromJSON(steps.create-commit-message.outputs.result), yet the commit message step returns a plain string (the co-author lines). If this string isn’t valid JSON, the conversion will fail. Verify whether the output should be a JSON-encoded value or adjust the usage by removing thefromJSONconversion if it’s unnecessary.
Below is a shell script to gather context from the workflow file regarding the definition of the
create-commit-messagestep. This will help verify whether its output (steps.create-commit-message.outputs.result) is produced as a JSON string or as plain text.
🏁 Script executed:
#!/bin/bash # Display context around the "create-commit-message" step in the workflow file. rg -C 5 "id:\s*create-commit-message" .github/workflows/automerge-for-humans-merging.ymlLength of output: 384
Below is a shell script to search for additional output handling around the
create-commit-messagestep. This will help determine whether its output is a JSON-encoded string or plain text.
🏁 Script executed:
#!/bin/bash # Search for any reference to JSON.stringify or similar constructs in the vicinity of the "create-commit-message" step. rg -C 10 "create-commit-message" .github/workflows/automerge-for-humans-merging.ymlLength of output: 1572
Merge Commit Message JSON Parsing Mismatch
The current workflow expects a JSON-encoded string via
fromJSON(steps.create-commit-message.outputs.result), but the "Create commit message" step returns a plain string (the co-author lines) without JSON encoding. This mismatch can lead to a conversion failure during the merge process. Please either update the commit message step toreturn JSON.stringify(coAuthors)(ensuring the output is valid JSON) or remove thefromJSONconversion within theMERGE_COMMIT_MESSAGEsetting.
- File:
.github/workflows/automerge-for-humans-merging.yml(Line 98)
🧹 Nitpick comments (3)
.github/workflows/automerge-for-humans-merging.yml (3)
43-62: Enhanced Commit Processing and Author Extraction LogicThe updated code now correctly checks for an empty commits list and extracts unique authors from the commits. However, when no commits are found, the script returns an empty string (
''), whereas a valid author mapping is expected later. For consistent behavior and type safety, consider returning an empty object ({}) instead.
73-78: Ensure Consistent ‘authors’ Output TypeIn this step the code uses
Object.keys(authors).lengthto verify the presence of authors. This check assumes that the output from the previous step is always an object. If an empty string is returned (as in the error case above), the behavior ofObject.keyscould be unexpected. Standardize the output so that it always returns an object (even if empty) to avoid potential type issues.
86-86: Remove Redundant SemicolonThe debug statement at line 86 contains an extra semicolon (
core.debug(coAuthors);;). Removing the redundant semicolon will help keep the code clean and adhere to best practices.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/automerge-for-humans-merging.yml(2 hunks)
⏰ Context from checks skipped due to timeout of 180000ms (1)
- GitHub Check: Lighthouse CI
|
/rtm |
Update automerge file.
Successful run: https://github.com/Shurtu-gal/action-test-bed/actions/runs/13926437541/job/38972102113?pr=4
Summary by CodeRabbit
Bug Fixes
New Features