fix(workflows): resolve yaml syntax error and python script exceptions#4938
fix(workflows): resolve yaml syntax error and python script exceptions#4938subodha-wijesekara wants to merge 1 commit intowso2:mainfrom
Conversation
This commit fixes two issues in the GitHub Actions workflows: - resolution_label_notifier.yml: Added missing closing single quote preventing valid YAML parsing. - label_checker.py: Swapped .index() to .find() to avoid ValueError on missing issue template fields and improved robust version extraction.
|
|
WalkthroughTwo GitHub Actions workflow files receive corrections to error handling and syntax. The label_checker.py script now safely extracts labels using boundary-aware string finding and conditional logic, while the notifier workflow fixes a malformed syntax error in a label check condition. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/label_checker.py:
- Around line 19-20: The extraction of component from os.environ["ISSUE_BODY"]
uses indices i and j but only checks they are not -1, allowing wrong order
(e.g., '### Version' before '### Affected Component') which yields malformed
text; change the condition to require i != -1 and j != -1 and j > i before
performing component = os.environ["ISSUE_BODY"][i+23:j].strip() so the slice
only occurs when the Affected Component header appears before the Version
header.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cd0e78cc-ee31-4bc4-b7de-c3d5dcbf0a37
📒 Files selected for processing (2)
.github/workflows/label_checker.py.github/workflows/resolution_label_notifier.yml
| if i != -1 and j != -1: | ||
| component = os.environ["ISSUE_BODY"][i+23:j].strip() |
There was a problem hiding this comment.
Add an order check before extracting component.
The current condition allows parsing even when ### Version appears before ### Affected Component, which can produce malformed component text. Require j > i before slicing.
Suggested patch
-if i != -1 and j != -1:
+if i != -1 and j != -1 and j > i:
component = os.environ["ISSUE_BODY"][i+23:j].strip()📝 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.
| if i != -1 and j != -1: | |
| component = os.environ["ISSUE_BODY"][i+23:j].strip() | |
| if i != -1 and j != -1 and j > i: | |
| component = os.environ["ISSUE_BODY"][i+23:j].strip() |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/label_checker.py around lines 19 - 20, The extraction of
component from os.environ["ISSUE_BODY"] uses indices i and j but only checks
they are not -1, allowing wrong order (e.g., '### Version' before '### Affected
Component') which yields malformed text; change the condition to require i != -1
and j != -1 and j > i before performing component =
os.environ["ISSUE_BODY"][i+23:j].strip() so the slice only occurs when the
Affected Component header appears before the Version header.
This commit fixes two issues in the GitHub Actions workflows:
resolution_label_notifier.yml: Added missing closing single quote preventing valid YAML parsing.
label_checker.py: Swapped .index() to .find() to avoid ValueError on missing issue template fields and improved robust version extraction.
Summary by CodeRabbit