diff --git a/.github/workflows/merge-to-stage.js b/.github/workflows/merge-to-stage.js index a5fcacabaa..4340921b88 100644 --- a/.github/workflows/merge-to-stage.js +++ b/.github/workflows/merge-to-stage.js @@ -18,19 +18,13 @@ const LABELS = { }; const SLACK = { - fileOverlap: ({ html_url, number, title }) => - `:fast_forward: Skipping <${html_url}|${number}: ${title}> due to overlap in files.`, merge: ({ html_url, number, title, highImpact }) => `:merged:${highImpact} PR merged to stage: <${html_url}|${number}: ${title}>.`, - failingChecks: ({ html_url, number, title }) => - `:x: Skipping <${html_url}|${number}: ${title}> due to failing checks`, - requireApprovals: ({ html_url, number, title }) => - `:x: Skipping <${html_url}|${number}: ${title}> due to insufficient approvals`, openedSyncPr: ({ html_url, number }) => `:fast_forward: Created <${html_url}|Stage to Main PR ${number}>`, }; -let github, owner, repo, currPrNumber, core; +let github, owner, repo; let body = ` ## common base root URLs @@ -104,19 +98,15 @@ const getPRs = async () => { ...prs.map((pr) => getReviews({ pr, github, owner, repo })), ]); - prs = prs.filter(({ checks, reviews, html_url, number, title }) => { + prs = prs.filter(({ checks, reviews, number, title }) => { if (hasFailingChecks(checks)) { - slackNotification(SLACK.failingChecks({ html_url, number, title })); - if (number === currPrNumber) - core.setFailed(`Failing checks on the current PR ${number}`); + console.log(`Skipping ${number}: ${title} due to failing checks`); return false; } const approvals = reviews.filter(({ state }) => state === 'APPROVED'); if (approvals.length < REQUIRED_APPROVALS) { - slackNotification(SLACK.requireApprovals({ html_url, number, title })); - if (number === currPrNumber) - core.setFailed(`Insufficient approvals on the current PR ${number}`); + console.log(`Skipping ${number}: ${title} due to insufficient approvals`); return false; } @@ -130,7 +120,7 @@ const merge = async ({ prs }) => { console.log(`Merging ${prs.length || 0} PRs that are ready... `); for await (const { number, files, html_url, title, labels } of prs) { if (files.some((file) => SEEN[file])) { - await slackNotification(SLACK.fileOverlap({ html_url, number, title })); + console.log(`Skipping ${number}: ${title} due to overlap in files.`); continue; } files.forEach((file) => (SEEN[file] = true)); @@ -222,8 +212,6 @@ const main = async (params) => { github = params.github; owner = params.context.repo.owner; repo = params.context.repo.repo; - currPrNumber = params.context.issue?.number; - core = params.core; const now = new Date(); // We need to revisit this every year @@ -256,7 +244,6 @@ if (process.env.LOCAL_RUN) { main({ github, context, - core: { setFailed: console.error }, }); } diff --git a/.github/workflows/merge-to-stage.yaml b/.github/workflows/merge-to-stage.yaml index a79fc9b8e0..406e226527 100644 --- a/.github/workflows/merge-to-stage.yaml +++ b/.github/workflows/merge-to-stage.yaml @@ -31,4 +31,4 @@ jobs: github-token: ${{ steps.milo-pr-merge-token.outputs.token }} script: | const main = require('./.github/workflows/merge-to-stage.js') - main({ github, context, core }) + main({ github, context })