Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
0xDEnYO committed Sep 6, 2024
1 parent 1ca3aff commit 6ff3e1d
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/verifyAudit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ jobs:
// Assign the required label if not already present
if (!assignedLabels.includes(labelToAssign)) {
console.log(`Assigning label: ${labelToAssign}`);
console.log(`Now assigning label: ${labelToAssign}`);
execSync(`gh pr edit ${{ github.event.pull_request.number }} --add-label "${labelToAssign}"`, { stdio: 'inherit' });
} else {
console.log(`${colors.green}Label "${labelToAssign}" is already assigned. No action needed.${colors.reset}`);
}
// Remove the opposite label if it is present
if (assignedLabels.includes(oppositeLabel)) {
console.log(`Removing opposite label: ${oppositeLabel}`);
console.log(`Now removing opposite label: ${oppositeLabel}`);
execSync(`gh pr edit ${{ github.event.pull_request.number }} --remove-label "${oppositeLabel}"`, { stdio: 'inherit' });
} else {
console.log(`${colors.green}Opposite label "${oppositeLabel}" is not assigned. No action needed.${colors.reset}`);
Expand All @@ -139,13 +139,7 @@ jobs:
}
// Verify that exactly one of the two labels is assigned
const requiredLabelCount = assignedLabels.filter(label => label === 'AuditRequired').length;
console.log(`requiredLabelCount: ${requiredLabelCount}`);
const notRequiredLabelCount = assignedLabels.filter(label => label === 'AuditNotRequired').length;
console.log(`notRequiredLabelCount: ${notRequiredLabelCount}`);
const totalLabelsAssigned = requiredLabelCount + notRequiredLabelCount;
console.log(`totalLabelsAssigned: ${totalLabelsAssigned}`);
const totalLabelsAssigned = assignedLabels.filter(label => ['AuditRequired', 'AuditNotRequired'].includes(label)).length;
if (totalLabelsAssigned !== 1) {
console.error(`${colors.red}Error: Exactly one of the two protected labels should be assigned but found ${totalLabelsAssigned} assigned labels.${colors.reset}`);
Expand Down

0 comments on commit 6ff3e1d

Please sign in to comment.