Skip to content

Commit

Permalink
[Github Workflow] Improve zero impact workflow logging (#2330)
Browse files Browse the repository at this point in the history
Improvements for the zero impact PR workflow
  • Loading branch information
mokimo authored May 17, 2024
1 parent 504e529 commit 285075f
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions .github/workflows/label-zero-impact.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,27 @@ const main = async ({ github, context }) => {
console.log(`PR ${number} is zero impact: ${isZeroImpactPR}.`);
if (isZeroImpactPR) {
console.log('Adding zero-impact label to PR.');
await github.rest.issues
.addLabels({
owner,
repo,
issue_number: number,
labels: [zeroImpactLabel],
})
.catch((e) => console.log(e));
await github.rest.issues.addLabels({
owner,
repo,
issue_number: number,
labels: [zeroImpactLabel],
});
} else {
console.log('Removing zero-impact label from PR.');
await github.rest.issues
.removeLabel({
owner,
repo,
issue_number: number,
name: zeroImpactLabel,
})
.catch((e) => console.log(e));

await github.rest.issues.removeLabel({
owner,
repo,
issue_number: number,
name: zeroImpactLabel,
});
console.log('Posting a comment on the PR.');
await github.rest.issues
.createComment({
owner,
repo,
issue_number: number,
body: 'This PR does not qualify for the zero-impact label as it touches code outside of the allowed areas. The label is auto applied, do not manually apply the label.',
})
.catch((e) => console.log(e));
await github.rest.issues.createComment({
owner,
repo,
issue_number: number,
body: 'This PR does not qualify for the zero-impact label as it touches code outside of the allowed areas. The label is auto applied, do not manually apply the label.',
});
}

console.log('Process successfully executed.');
Expand Down

0 comments on commit 285075f

Please sign in to comment.