Skip to content

Commit

Permalink
#29618: filtering non 'QA : Not Needed' labels from being executed
Browse files Browse the repository at this point in the history
  • Loading branch information
victoralfaro-dotcms committed Sep 11, 2024
1 parent 7f140fe commit e27df41
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions .github/workflows/issue_comp_next-release-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,29 @@ jobs:
const issue = context.payload.issue;
if (!issue && '${{ inputs.issue_number }}'.trim() === '') {
console.log('Issue number is not provided');
process.exit(0);
process.exit(1);
}
const label = context.payload.label;
if (!label && '${{ inputs.label }}' !== '${{ env.QA_NOT_NEEDED_LABEL }}') {
console.log('Label is not "${{ env.QA_NOT_NEEDED_LABEL }}", exiting');
process.exit(0);
let label = context.payload.label;
if (!label) {
if (!'${{ inputs.label }}') {
console.log('Label is missing, exiting');
process.exit(2);
}
label = '${{ inputs.label }}';
} else {
label = label.name;
}
if (label !== '${{ env.QA_NOT_NEEDED_LABEL }}') {
console.log('Label is not [${{ env.QA_NOT_NEEDED_LABEL }}], exiting');
process.exit(3);
}
core.setOutput('label', label);
- name: Add Next Release label
uses: actions/github-script@v7
if: success()
with:
result-encoding: string
retries: 3
Expand All @@ -68,7 +81,7 @@ jobs:
if (!issue) {
console.log('Issue [${{ inputs.issue_number }}] not found');
process.exit(0);
process.exit(4);
}
}
Expand All @@ -78,14 +91,14 @@ jobs:
const dropAndLearnText = 'Drop Everything & Learn';
if (issue.title.includes(dropAndLearnText)) {
console.log(`Issue does have "${dropAndLearnText}" text in title, exiting`);
process.exit(0);
process.exit(5);
}
const typeCicdLabel = 'Type : CI/CD';
const foundLabel = issue.labels.find(label => label.name === typeCicdLabel);
if (foundLabel) {
console.log(`Issue does have "${typeCicdLabel}" label , exiting`);
process.exit(0);
process.exit(6);
}
await github.rest.issues.addLabels({
Expand All @@ -97,3 +110,9 @@ jobs:
const updated = await getIssue(issueNumber);
console.log(`Labels: ${JSON.stringify(updated.labels, null, 2)}`);
- name: Finalize
if: always()
run: |
echo 'Finalizing NExt release labeling'
exit 0

0 comments on commit e27df41

Please sign in to comment.