Skip to content
Open
Changes from all 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
27 changes: 21 additions & 6 deletions .github/workflows/setup-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,30 @@ jobs:
name: 'size/XL',
color: 'FF0000',
description: 'Extra large PR (>500 lines changed)'
},

// ==================== AUTOMATION LABELS ====================
{
name: 'pending-coderabbit-review',
color: 'FBCA04',
description: 'Waiting for CodeRabbit automated review'
},
{
name: 'template_sync',
color: 'BFDADC',
description: 'PR created by template sync workflow'
},
{
name: 'auto_pr',
color: '0E8A16',
description: 'Automatically generated pull request'
}
];

console.log('='.repeat(60));
console.log('🏷️ REPOSITORY LABEL SETUP');
console.log('='.repeat(60));
console.log(`Total labels to create: ${requiredLabels.length}\n`);

// Get existing labels with pagination
const existingLabels = await github.paginate(
github.rest.issues.listLabelsForRepo,
Expand All @@ -151,12 +167,11 @@ jobs:
let updated = 0;
let skipped = 0;
let failed = 0;

// Process each label
for (const label of requiredLabels) {
try {
if (!existingLabelNames.includes(label.name)) {
// Create new label
// Create new label
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down Expand Up @@ -190,7 +205,7 @@ jobs:
}
}

// Summary
// Summary
console.log('\n' + '='.repeat(60));
console.log('📊 SUMMARY');
console.log('='.repeat(60));
Expand All @@ -200,11 +215,11 @@ jobs:
console.log(`❌ Failed: ${failed}`);
console.log('='.repeat(60));

// Fail the step if any labels failed to create/update
// Fail the step if any labels failed to create/update
if (failed > 0) {
core.setFailed(`Label setup failed! ${failed} label(s) could not be created or updated.`);
} else if (created > 0 || updated > 0) {
console.log('\n🎉 Label setup complete! Your repository is ready.');
} else {
console.log('\n✨ All labels are already up to date.');
}
}