Skip to content

Commit

Permalink
fix(action): remove QA label check
Browse files Browse the repository at this point in the history
  • Loading branch information
gauthierpetetin committed Jul 19, 2023
1 parent 9da1c4d commit 6864e4b
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions .github/scripts/check-pr-has-required-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,26 @@ async function main(): Promise<void> {
// Retrieve pull request labels
const prLabels = await retrievePullRequestLabels(octokit, prRepoOwner, prRepoName, prNumber);

const qaLabels = ["QA Passed", "No QA Needed/E2E Only", "Spot Check on the Release Build"];
const preventMergeLabels = ["needs-qa", "QA'd but questions", "issues-found"];

let hasQALabel = false;
let hasTeamLabel = false;

// Check pull request has at least required QA label and team label
for (const label of prLabels) {
if (qaLabels.includes(label)) {
console.log(`PR contains a QA label as expected: ${label}`);
hasQALabel = true;
}
if (label.startsWith("team-")) {
if (label.startsWith("team-") || label === "external-contributor") {
console.log(`PR contains a team label as expected: ${label}`);
hasTeamLabel = true;
}
if (preventMergeLabels.includes(label)) {
throw new Error(`PR cannot be merged because it still contains this label: ${label}`);
}
if (hasQALabel && hasTeamLabel) {
if (hasTeamLabel) {
return;
}
}

// Otherwise, throw an arror to prevent from merging
let errorMessage = '';
if (!hasQALabel) {
errorMessage += 'No QA labels found on the PR. ';
}
if (!hasTeamLabel) {
errorMessage += 'No team labels found on the PR. ';
}
Expand Down

0 comments on commit 6864e4b

Please sign in to comment.