Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions .github/scripts/coderabbit_plan_trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ async function triggerCodeRabbitPlan(github, owner, repo, issue, marker) {
}
}

function hasIntermediateOrAdvancedLabel(issue, label) {
// Check if issue has intermediate or advanced label (case-insensitive)
const hasIntermediateLabel = issue.labels?.some(l => l?.name?.toLowerCase() === 'intermediate');
const hasAdvancedLabel = issue.labels?.some(l => l?.name?.toLowerCase() === 'advanced');

function hasBeginnerOrHigherLabel(issue, label) {
// Check if issue has beginner, intermediate or advanced label (case-insensitive)

const allowed = ['beginner', 'intermediate', "advanced"];

const hasAllowedLabel = issue.labels?.some(l => allowed.includes(l?.name?.toLowerCase()));

// Also check if newly added label is intermediate/advanced
const isNewLabelIntermediate = label?.name?.toLowerCase() === 'intermediate';
const isNewLabelAdvanced = label?.name?.toLowerCase() === 'advanced';

const isNewLabelAllowed = allowed.includes(label?.name?.toLowerCase());

return hasAllowedLabel || isNewLabelAllowed;

return hasIntermediateLabel || hasAdvancedLabel || isNewLabelIntermediate || isNewLabelAdvanced;
}

async function hasExistingCodeRabbitPlan(github, owner, repo, issueNumber) {
Expand Down Expand Up @@ -65,7 +68,7 @@ module.exports = async ({ github, context }) => {
// Validations
if (!issue?.number) return console.log('No issue in payload');

if (!hasIntermediateOrAdvancedLabel(issue, label)) {
if (!hasBeginnerOrHigherLabel(issue, label)) {
return console.log('Issue does not have intermediate or advanced label');
}

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
- Improved unit test coverage for `TransactionId` class, covering parsing logic, hashing, and scheduled transactions.

### Changed
- Modified and renamed hasIntermediateOrAdvancedLabel() to check if issue label is beginner or higher (#1385)
- Added global review instructions to CodeRabbit configuration to limit reviews to issue/PR scope and prevent scope creep [#1373]
- Archived unused auto draft GitHub workflow to prevent it from running (#1371)
- Added comprehensive documentation to the PR changelog check script (`.github/scripts/pr-check-changelog.sh`) to clarify behavior, inputs, permissions, and dependencies [(#1337)]
- Refactored `account_create_transaction_without_alias.py` into smaller, modular functions.(#1321)
- Renamed bot-inactivity workflow files to remove "-phase" suffix since the process no longer uses phased execution (#1339)
Expand Down
Loading