Skip to content

fix(workflows): resolve yaml syntax error and python script exceptions#4938

Open
subodha-wijesekara wants to merge 2 commits intowso2:mainfrom
subodha-wijesekara:fix/github-actions-bugs
Open

fix(workflows): resolve yaml syntax error and python script exceptions#4938
subodha-wijesekara wants to merge 2 commits intowso2:mainfrom
subodha-wijesekara:fix/github-actions-bugs

Conversation

@subodha-wijesekara
Copy link
Copy Markdown

@subodha-wijesekara subodha-wijesekara commented Apr 11, 2026

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.

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.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2f5d7ac4-3d2d-4ff9-8e2e-1c5c64ce12a3

📥 Commits

Reviewing files that changed from the base of the PR and between 63d7740 and 1e31718.

📒 Files selected for processing (1)
  • .github/workflows/label_checker.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/label_checker.py

📝 Walkthrough

Changes

.github/workflows/resolution_label_notifier.yml

Fixed a YAML syntax error by adding a missing closing single quote in the workflow condition that checks for the Resolution/Done label. This corrects the malformed conditional expression and ensures the workflow logic evaluates correctly.

.github/workflows/label_checker.py

Enhanced robustness of the issue label extraction logic:

  • Replaced .index() calls with .find() method to safely detect section markers (### Affected Component and ### Version), preventing exceptions when these markers are absent from issue templates
  • Made component label extraction conditional—component labels are only added when both required markers are found
  • Improved version extraction by dynamically locating the section content between the ### Version marker and the next section header, rather than using fixed position slicing
  • Made the Affected/<component>-<version> label addition conditional on the component being successfully extracted

These changes allow the script to gracefully handle missing template sections without raising errors while maintaining correct label assignment functionality.

Walkthrough

Two GitHub Actions workflow-related changes: the label_checker.py script now uses boundary-aware find() checks and conditional extraction for the ### Affected Component and ### Version sections, and the resolution_label_notifier workflow file fixes a missing closing quote in a contains(..., 'Resolution/Done') conditional.

Changes

Cohort / File(s) Summary
Label Extraction Error Handling
.github/workflows/label_checker.py
Replaced unsafe index() usage with find() and -1 checks. Component extraction only runs when both ### Affected Component and ### Version markers exist and are ordered (j > i). Version extraction now takes the ### Version section content up to the next ### header (or the end of the body). Adding Affected/<component>-<version> is conditional on a valid component.
Workflow Syntax Fix
.github/workflows/resolution_label_notifier.yml
Closed the missing single quote in the contains(..., 'Resolution/Done') condition to correct the malformed if: expression.

Estimated code review effort

🎯 Medium | ⏱️ ~20 minutes

Poem

Quotes fixed, markers checked with care;
Boundaries respected, malformed checks repaired.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and specifically describes the two main fixes in the changeset: YAML syntax error in the workflow file and Python script exception handling improvements.
Description check ✅ Passed The description accurately relates to the changeset by detailing the two specific issues fixed: the missing quote in the YAML file and the .index() to .find() replacement in the Python script.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c16a70e and 63d7740.

📒 Files selected for processing (2)
  • .github/workflows/label_checker.py
  • .github/workflows/resolution_label_notifier.yml

Comment thread .github/workflows/label_checker.py Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants