From c195e55886bbf1fb1d6d67800a917086290ee250 Mon Sep 17 00:00:00 2001 From: Austin Wu Date: Thu, 23 Apr 2026 13:44:48 -0500 Subject: [PATCH] fix multiple merge safety's bug --- dist/helpers/check-merge-safety.js | 9 +++---- dist/helpers/check-merge-safety.js.map | 6 ++--- src/helpers/check-merge-safety.ts | 7 ++---- test/helpers/check-merge-safety.test.ts | 32 ++++++++++++++++++++++++- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/dist/helpers/check-merge-safety.js b/dist/helpers/check-merge-safety.js index 7a886ca1..65854701 100644 --- a/dist/helpers/check-merge-safety.js +++ b/dist/helpers/check-merge-safety.js @@ -91,11 +91,8 @@ var checkForExistingFailureStatus = async (pullRequest, context2) => { ...context.repo, ref: pullRequest.head.sha }); - if (data.state === "failure") { - const existingContext = data.statuses.find((status) => status.context === context2); - return Boolean(existingContext); - } - return false; + const existingContext = data.statuses.find((status) => status.context === context2); + return existingContext?.state === "failure"; }; var fetchSha = async (repoUrl, sha) => { try { @@ -259,4 +256,4 @@ export { CheckMergeSafety }; -//# debugId=41C4FA0898BE964F64756E2164756E21 +//# debugId=7687825B6B00F97364756E2164756E21 diff --git a/dist/helpers/check-merge-safety.js.map b/dist/helpers/check-merge-safety.js.map index c453d55c..94a05c2c 100644 --- a/dist/helpers/check-merge-safety.js.map +++ b/dist/helpers/check-merge-safety.js.map @@ -2,9 +2,9 @@ "version": 3, "sources": ["../src/helpers/check-merge-safety.ts"], "sourcesContent": [ - "/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { HelperInputs } from '../types/generated';\nimport { context as githubContext } from '@actions/github';\nimport { simpleGit } from 'simple-git';\nimport { octokit } from '../octokit';\nimport micromatch from 'micromatch';\nimport { GithubError, PullRequest } from '../types/github';\nimport { paginateAllOpenPullRequests } from '../utils/paginate-open-pull-requests';\nimport { map } from 'bluebird';\nimport { setCommitStatus } from './set-commit-status';\nimport * as core from '@actions/core';\n\nconst git = simpleGit();\n\nconst maxBranchNameLength = 50;\nconst COMMENT_PATHS_MARKER = '';\n\nconst getWorkflowRunUrl = () =>\n `${githubContext.serverUrl}/${githubContext.repo.owner}/${githubContext.repo.repo}/actions/runs/${githubContext.runId}`;\n\nexport class CheckMergeSafety extends HelperInputs {\n declare context?: string;\n declare paths?: string;\n declare ignore_globs?: string;\n declare override_filter_paths?: string;\n declare override_filter_globs?: string;\n declare match_comment_paths?: string;\n}\n\nexport const checkMergeSafety = async (inputs: CheckMergeSafety) => {\n core.warning(\n \"check-merge-safety is deprecated. Please use GitHub's native merge queue: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue\"\n );\n const isPrWorkflow = Boolean(githubContext.issue.number);\n if (!isPrWorkflow) {\n return handlePushWorkflow(inputs);\n }\n const { data: pullRequest } = await octokit.pulls.get({ pull_number: githubContext.issue.number, ...githubContext.repo });\n\n const { state, message } = await setMergeSafetyStatus(pullRequest, inputs);\n if (state === 'failure') {\n core.setFailed(message);\n }\n};\n\nconst setMergeSafetyStatus = async (pullRequest: PullRequest, { context = 'Merge Safety', ...inputs }: CheckMergeSafety) => {\n const { state, message } = await getMergeSafetyStateAndMessage(pullRequest, inputs);\n const hasExistingFailureStatus = await checkForExistingFailureStatus(pullRequest, context);\n if (hasExistingFailureStatus && state === 'failure') {\n const {\n head: {\n ref,\n user: { login: username }\n }\n } = pullRequest;\n const truncatedRef = ref.length > maxBranchNameLength ? `${ref.substring(0, maxBranchNameLength)}...` : ref;\n const truncatedBranchName = `${username}:${truncatedRef}`;\n core.info(`Found existing failure status for ${truncatedBranchName}, skipping setting new status`);\n } else {\n await setCommitStatus({\n sha: pullRequest.head.sha,\n state,\n context,\n description: message,\n target_url: getWorkflowRunUrl(),\n ...githubContext.repo\n });\n }\n\n return { state, message };\n};\n\nconst handlePushWorkflow = async (inputs: CheckMergeSafety) => {\n const pullRequests = await paginateAllOpenPullRequests();\n const filteredPullRequests = pullRequests.filter(({ base, draft }) => !draft && base.ref === base.repo.default_branch);\n await map(filteredPullRequests, pullRequest => setMergeSafetyStatus(pullRequest as PullRequest, inputs));\n};\n\nconst checkForExistingFailureStatus = async (pullRequest: PullRequest, context: string) => {\n const { data } = await octokit.repos.getCombinedStatusForRef({\n ...githubContext.repo,\n ref: pullRequest.head.sha\n });\n if (data.state === 'failure') {\n const existingContext = data.statuses.find(status => status.context === context);\n return Boolean(existingContext);\n }\n return false;\n};\n\nconst fetchSha = async (repoUrl: string, sha: string) => {\n try {\n await git.fetch(repoUrl, sha, { '--depth': 1 });\n core.info(`Fetched ${sha} from ${repoUrl}`);\n } catch (err) {\n core.info(`Failed to fetch ${sha} from ${repoUrl}: ${(err as GithubError).message}`);\n throw new Error(`Failed to fetch ${sha} from ${repoUrl}: ${(err as GithubError).message}`);\n }\n};\n\nconst getDiffUsingGitCommand = async (repoUrl: string, baseSha: string, headSha: string): Promise => {\n // update local repo copy\n await fetchSha(repoUrl, baseSha);\n await fetchSha(repoUrl, headSha);\n\n try {\n const diff = await git.diff(['--name-only', baseSha, headSha]);\n return (diff ?? '').split('\\n').filter(Boolean);\n } catch (err) {\n core.error(`Failed to run local git diff for ${repoUrl}: ${(err as GithubError).message}`);\n throw new Error(`Failed to run local git diff for ${repoUrl}: ${(err as GithubError).message}`);\n }\n};\n\ntype DiffRefs = PullRequest['base' | 'head'];\nconst getDiff = async (compareBase: DiffRefs, compareHead: DiffRefs, basehead: string) => {\n let changedFileNames: string[] = [];\n try {\n const { data: { files: changedFiles } = {}, status } = await octokit.repos.compareCommitsWithBasehead({\n ...githubContext.repo,\n basehead\n });\n if (status > 400) {\n throw { status };\n }\n changedFileNames = changedFiles?.map(file => file.filename) ?? [];\n } catch (err) {\n core.info(`Failed to fetch diff: ${(err as GithubError).message} Status: ${(err as GithubError).status}`);\n\n // diff too large error\n if ((err as GithubError)?.status === 406 || (err as GithubError)?.message.includes('diff is taking too long to generate')) {\n core.info(`Attempting to generate diff using local git command`);\n if (compareBase.repo?.html_url) {\n changedFileNames = await getDiffUsingGitCommand(compareBase.repo?.html_url, compareBase.sha, compareHead.sha);\n } else {\n core.error(`Could not fetch repo url to run local git diff`);\n throw err;\n }\n } else {\n throw err;\n }\n }\n return changedFileNames;\n};\n\nconst getMergeSafetyStateAndMessage = async (\n pullRequest: PullRequest,\n { paths, ignore_globs, override_filter_paths, override_filter_globs, match_comment_paths }: CheckMergeSafety\n) => {\n const {\n base: {\n repo: {\n default_branch,\n owner: { login: baseOwner }\n }\n },\n head: {\n ref,\n user: { login: username }\n }\n } = pullRequest;\n\n const branchName = `${username}:${ref}`;\n const diffAgainstUserBranch = `${branchName}...${baseOwner}:${default_branch}`;\n let fileNamesWhichBranchIsBehindOn;\n try {\n fileNamesWhichBranchIsBehindOn = await getDiff(pullRequest.head, pullRequest.base, diffAgainstUserBranch);\n } catch (err) {\n const message = diffErrorMessage(diffAgainstUserBranch, (err as GithubError).message);\n core.error(message);\n return { state: 'failure', message } as const;\n }\n\n const truncatedRef = ref.length > maxBranchNameLength ? `${ref.substring(0, maxBranchNameLength)}...` : ref;\n const truncatedBranchName = `${username}:${truncatedRef}`;\n\n if (match_comment_paths === 'true') {\n const commentPaths = await getPathsFromComment(pullRequest.number);\n\n if (commentPaths.length) {\n core.info(`Found ${commentPaths.length} paths from PR comment`);\n\n const outdatedCommentPaths = commentPaths.filter(commentPath =>\n fileNamesWhichBranchIsBehindOn.some(file => file.startsWith(commentPath + '/') || file === commentPath)\n );\n\n if (outdatedCommentPaths.length) {\n core.error(buildErrorMessage(outdatedCommentPaths, 'comment paths', truncatedBranchName));\n return {\n state: 'failure',\n message: `Branch is behind on ${outdatedCommentPaths.length} path(s) from comment. Please update with ${default_branch}.`\n } as const;\n }\n } else {\n core.info('No paths found in PR comment, skipping comment path matching check');\n }\n }\n\n const globalFilesOutdatedOnBranch = override_filter_globs\n ? micromatch(fileNamesWhichBranchIsBehindOn, override_filter_globs.split(/[\\n,]/))\n : override_filter_paths\n ? fileNamesWhichBranchIsBehindOn.filter(changedFile => override_filter_paths.split(/[\\n,]/).includes(changedFile))\n : [];\n\n if (globalFilesOutdatedOnBranch.length) {\n core.error(buildErrorMessage(globalFilesOutdatedOnBranch, 'global files', truncatedBranchName));\n return {\n state: 'failure',\n message: `This branch has one or more outdated global files. Please update with ${default_branch}.`\n } as const;\n }\n\n const diffAgainstDefaultBranch = `${baseOwner}:${default_branch}...${branchName}`;\n let changedFileNames;\n try {\n changedFileNames = await getDiff(pullRequest.base, pullRequest.head, diffAgainstDefaultBranch);\n } catch (err) {\n const message = diffErrorMessage(diffAgainstDefaultBranch, (err as GithubError).message);\n core.error(message);\n return { state: 'failure', message } as const;\n }\n\n const changedFilesToIgnore = changedFileNames && ignore_globs ? micromatch(changedFileNames, ignore_globs.split(/[\\n,]/)) : [];\n const filteredFileNames = changedFileNames?.filter(file => !changedFilesToIgnore.includes(file));\n const allProjectDirectories = paths?.split(/[\\n,]/);\n\n const changedProjectsOutdatedOnBranch = allProjectDirectories?.filter(\n dir => fileNamesWhichBranchIsBehindOn.some(file => file.includes(dir)) && filteredFileNames?.some(file => file.includes(dir))\n );\n\n if (changedProjectsOutdatedOnBranch?.length) {\n core.error(buildErrorMessage(changedProjectsOutdatedOnBranch, 'projects', truncatedBranchName));\n return {\n state: 'failure',\n message: `This branch has one or more outdated projects. Please update with ${default_branch}.`\n } as const;\n }\n\n const safeMessage = buildSuccessMessage(truncatedBranchName);\n core.info(safeMessage);\n return {\n state: 'success',\n message: safeMessage\n } as const;\n};\n\nconst buildErrorMessage = (paths: string[], pathType: 'projects' | 'global files' | 'comment paths', branchName: string) =>\n `\nThe following ${pathType} are outdated on branch ${branchName}\n\n${paths.map(path => `* ${path}`).join('\\n')}\n`;\n\nconst diffErrorMessage = (basehead: string, message = '') =>\n `Failed to generate diff for ${basehead}. Please verify SHAs are valid and try again.${message ? `\\nError: ${message}` : ''}`;\n\nconst buildSuccessMessage = (branchName: string) => `Branch ${branchName} is safe to merge!`;\n\nconst getPathsFromComment = async (pullNumber: number): Promise => {\n const { data: comments } = await octokit.issues.listComments({\n ...githubContext.repo,\n issue_number: pullNumber\n });\n\n const pathsComment = comments.find(c => c.body?.includes(COMMENT_PATHS_MARKER));\n if (!pathsComment?.body) {\n return [];\n }\n\n const jsonMatch = pathsComment.body.match(/```json\\n([\\s\\S]*?)\\n```/);\n if (!jsonMatch?.[1]) {\n return [];\n }\n\n try {\n const parsed: unknown = JSON.parse(jsonMatch[1]);\n if (Array.isArray(parsed) && parsed.every(item => typeof item === 'string')) {\n return parsed;\n }\n return [];\n } catch {\n core.warning(`Failed to parse paths from PR #${pullNumber} comment`);\n return [];\n }\n};\n" + "/*\nCopyright 2021 Expedia, Inc.\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n https://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { HelperInputs } from '../types/generated';\nimport { context as githubContext } from '@actions/github';\nimport { simpleGit } from 'simple-git';\nimport { octokit } from '../octokit';\nimport micromatch from 'micromatch';\nimport { GithubError, PullRequest } from '../types/github';\nimport { paginateAllOpenPullRequests } from '../utils/paginate-open-pull-requests';\nimport { map } from 'bluebird';\nimport { setCommitStatus } from './set-commit-status';\nimport * as core from '@actions/core';\n\nconst git = simpleGit();\n\nconst maxBranchNameLength = 50;\nconst COMMENT_PATHS_MARKER = '';\n\nconst getWorkflowRunUrl = () =>\n `${githubContext.serverUrl}/${githubContext.repo.owner}/${githubContext.repo.repo}/actions/runs/${githubContext.runId}`;\n\nexport class CheckMergeSafety extends HelperInputs {\n declare context?: string;\n declare paths?: string;\n declare ignore_globs?: string;\n declare override_filter_paths?: string;\n declare override_filter_globs?: string;\n declare match_comment_paths?: string;\n}\n\nexport const checkMergeSafety = async (inputs: CheckMergeSafety) => {\n core.warning(\n \"check-merge-safety is deprecated. Please use GitHub's native merge queue: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue\"\n );\n const isPrWorkflow = Boolean(githubContext.issue.number);\n if (!isPrWorkflow) {\n return handlePushWorkflow(inputs);\n }\n const { data: pullRequest } = await octokit.pulls.get({ pull_number: githubContext.issue.number, ...githubContext.repo });\n\n const { state, message } = await setMergeSafetyStatus(pullRequest, inputs);\n if (state === 'failure') {\n core.setFailed(message);\n }\n};\n\nconst setMergeSafetyStatus = async (pullRequest: PullRequest, { context = 'Merge Safety', ...inputs }: CheckMergeSafety) => {\n const { state, message } = await getMergeSafetyStateAndMessage(pullRequest, inputs);\n const hasExistingFailureStatus = await checkForExistingFailureStatus(pullRequest, context);\n if (hasExistingFailureStatus && state === 'failure') {\n const {\n head: {\n ref,\n user: { login: username }\n }\n } = pullRequest;\n const truncatedRef = ref.length > maxBranchNameLength ? `${ref.substring(0, maxBranchNameLength)}...` : ref;\n const truncatedBranchName = `${username}:${truncatedRef}`;\n core.info(`Found existing failure status for ${truncatedBranchName}, skipping setting new status`);\n } else {\n await setCommitStatus({\n sha: pullRequest.head.sha,\n state,\n context,\n description: message,\n target_url: getWorkflowRunUrl(),\n ...githubContext.repo\n });\n }\n\n return { state, message };\n};\n\nconst handlePushWorkflow = async (inputs: CheckMergeSafety) => {\n const pullRequests = await paginateAllOpenPullRequests();\n const filteredPullRequests = pullRequests.filter(({ base, draft }) => !draft && base.ref === base.repo.default_branch);\n await map(filteredPullRequests, pullRequest => setMergeSafetyStatus(pullRequest as PullRequest, inputs));\n};\n\nconst checkForExistingFailureStatus = async (pullRequest: PullRequest, context: string) => {\n const { data } = await octokit.repos.getCombinedStatusForRef({\n ...githubContext.repo,\n ref: pullRequest.head.sha\n });\n const existingContext = data.statuses.find(status => status.context === context);\n return existingContext?.state === 'failure';\n};\n\nconst fetchSha = async (repoUrl: string, sha: string) => {\n try {\n await git.fetch(repoUrl, sha, { '--depth': 1 });\n core.info(`Fetched ${sha} from ${repoUrl}`);\n } catch (err) {\n core.info(`Failed to fetch ${sha} from ${repoUrl}: ${(err as GithubError).message}`);\n throw new Error(`Failed to fetch ${sha} from ${repoUrl}: ${(err as GithubError).message}`);\n }\n};\n\nconst getDiffUsingGitCommand = async (repoUrl: string, baseSha: string, headSha: string): Promise => {\n // update local repo copy\n await fetchSha(repoUrl, baseSha);\n await fetchSha(repoUrl, headSha);\n\n try {\n const diff = await git.diff(['--name-only', baseSha, headSha]);\n return (diff ?? '').split('\\n').filter(Boolean);\n } catch (err) {\n core.error(`Failed to run local git diff for ${repoUrl}: ${(err as GithubError).message}`);\n throw new Error(`Failed to run local git diff for ${repoUrl}: ${(err as GithubError).message}`);\n }\n};\n\ntype DiffRefs = PullRequest['base' | 'head'];\nconst getDiff = async (compareBase: DiffRefs, compareHead: DiffRefs, basehead: string) => {\n let changedFileNames: string[] = [];\n try {\n const { data: { files: changedFiles } = {}, status } = await octokit.repos.compareCommitsWithBasehead({\n ...githubContext.repo,\n basehead\n });\n if (status > 400) {\n throw { status };\n }\n changedFileNames = changedFiles?.map(file => file.filename) ?? [];\n } catch (err) {\n core.info(`Failed to fetch diff: ${(err as GithubError).message} Status: ${(err as GithubError).status}`);\n\n // diff too large error\n if ((err as GithubError)?.status === 406 || (err as GithubError)?.message.includes('diff is taking too long to generate')) {\n core.info(`Attempting to generate diff using local git command`);\n if (compareBase.repo?.html_url) {\n changedFileNames = await getDiffUsingGitCommand(compareBase.repo?.html_url, compareBase.sha, compareHead.sha);\n } else {\n core.error(`Could not fetch repo url to run local git diff`);\n throw err;\n }\n } else {\n throw err;\n }\n }\n return changedFileNames;\n};\n\nconst getMergeSafetyStateAndMessage = async (\n pullRequest: PullRequest,\n { paths, ignore_globs, override_filter_paths, override_filter_globs, match_comment_paths }: CheckMergeSafety\n) => {\n const {\n base: {\n repo: {\n default_branch,\n owner: { login: baseOwner }\n }\n },\n head: {\n ref,\n user: { login: username }\n }\n } = pullRequest;\n\n const branchName = `${username}:${ref}`;\n const diffAgainstUserBranch = `${branchName}...${baseOwner}:${default_branch}`;\n let fileNamesWhichBranchIsBehindOn;\n try {\n fileNamesWhichBranchIsBehindOn = await getDiff(pullRequest.head, pullRequest.base, diffAgainstUserBranch);\n } catch (err) {\n const message = diffErrorMessage(diffAgainstUserBranch, (err as GithubError).message);\n core.error(message);\n return { state: 'failure', message } as const;\n }\n\n const truncatedRef = ref.length > maxBranchNameLength ? `${ref.substring(0, maxBranchNameLength)}...` : ref;\n const truncatedBranchName = `${username}:${truncatedRef}`;\n\n if (match_comment_paths === 'true') {\n const commentPaths = await getPathsFromComment(pullRequest.number);\n\n if (commentPaths.length) {\n core.info(`Found ${commentPaths.length} paths from PR comment`);\n\n const outdatedCommentPaths = commentPaths.filter(commentPath =>\n fileNamesWhichBranchIsBehindOn.some(file => file.startsWith(commentPath + '/') || file === commentPath)\n );\n\n if (outdatedCommentPaths.length) {\n core.error(buildErrorMessage(outdatedCommentPaths, 'comment paths', truncatedBranchName));\n return {\n state: 'failure',\n message: `Branch is behind on ${outdatedCommentPaths.length} path(s) from comment. Please update with ${default_branch}.`\n } as const;\n }\n } else {\n core.info('No paths found in PR comment, skipping comment path matching check');\n }\n }\n\n const globalFilesOutdatedOnBranch = override_filter_globs\n ? micromatch(fileNamesWhichBranchIsBehindOn, override_filter_globs.split(/[\\n,]/))\n : override_filter_paths\n ? fileNamesWhichBranchIsBehindOn.filter(changedFile => override_filter_paths.split(/[\\n,]/).includes(changedFile))\n : [];\n\n if (globalFilesOutdatedOnBranch.length) {\n core.error(buildErrorMessage(globalFilesOutdatedOnBranch, 'global files', truncatedBranchName));\n return {\n state: 'failure',\n message: `This branch has one or more outdated global files. Please update with ${default_branch}.`\n } as const;\n }\n\n const diffAgainstDefaultBranch = `${baseOwner}:${default_branch}...${branchName}`;\n let changedFileNames;\n try {\n changedFileNames = await getDiff(pullRequest.base, pullRequest.head, diffAgainstDefaultBranch);\n } catch (err) {\n const message = diffErrorMessage(diffAgainstDefaultBranch, (err as GithubError).message);\n core.error(message);\n return { state: 'failure', message } as const;\n }\n\n const changedFilesToIgnore = changedFileNames && ignore_globs ? micromatch(changedFileNames, ignore_globs.split(/[\\n,]/)) : [];\n const filteredFileNames = changedFileNames?.filter(file => !changedFilesToIgnore.includes(file));\n const allProjectDirectories = paths?.split(/[\\n,]/);\n\n const changedProjectsOutdatedOnBranch = allProjectDirectories?.filter(\n dir => fileNamesWhichBranchIsBehindOn.some(file => file.includes(dir)) && filteredFileNames?.some(file => file.includes(dir))\n );\n\n if (changedProjectsOutdatedOnBranch?.length) {\n core.error(buildErrorMessage(changedProjectsOutdatedOnBranch, 'projects', truncatedBranchName));\n return {\n state: 'failure',\n message: `This branch has one or more outdated projects. Please update with ${default_branch}.`\n } as const;\n }\n\n const safeMessage = buildSuccessMessage(truncatedBranchName);\n core.info(safeMessage);\n return {\n state: 'success',\n message: safeMessage\n } as const;\n};\n\nconst buildErrorMessage = (paths: string[], pathType: 'projects' | 'global files' | 'comment paths', branchName: string) =>\n `\nThe following ${pathType} are outdated on branch ${branchName}\n\n${paths.map(path => `* ${path}`).join('\\n')}\n`;\n\nconst diffErrorMessage = (basehead: string, message = '') =>\n `Failed to generate diff for ${basehead}. Please verify SHAs are valid and try again.${message ? `\\nError: ${message}` : ''}`;\n\nconst buildSuccessMessage = (branchName: string) => `Branch ${branchName} is safe to merge!`;\n\nconst getPathsFromComment = async (pullNumber: number): Promise => {\n const { data: comments } = await octokit.issues.listComments({\n ...githubContext.repo,\n issue_number: pullNumber\n });\n\n const pathsComment = comments.find(c => c.body?.includes(COMMENT_PATHS_MARKER));\n if (!pathsComment?.body) {\n return [];\n }\n\n const jsonMatch = pathsComment.body.match(/```json\\n([\\s\\S]*?)\\n```/);\n if (!jsonMatch?.[1]) {\n return [];\n }\n\n try {\n const parsed: unknown = JSON.parse(jsonMatch[1]);\n if (Array.isArray(parsed) && parsed.every(item => typeof item === 'string')) {\n return parsed;\n }\n return [];\n } catch {\n core.warning(`Failed to parse paths from PR #${pullNumber} comment`);\n return [];\n }\n};\n" ], - "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA;AAGA;AAIA,IAAM,MAAM,UAAU;AAEtB,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAE7B,IAAM,oBAAoB,MACxB,GAAG,QAAc,aAAa,QAAc,KAAK,SAAS,QAAc,KAAK,qBAAqB,QAAc;AAAA;AAE3G,MAAM,yBAAyB,aAAa;AAOnD;AAEO,IAAM,mBAAmB,OAAO,WAA6B;AAAA,EAC7D,QACH,6NACF;AAAA,EACA,MAAM,eAAe,QAAQ,QAAc,MAAM,MAAM;AAAA,EACvD,IAAI,CAAC,cAAc;AAAA,IACjB,OAAO,mBAAmB,MAAM;AAAA,EAClC;AAAA,EACA,QAAQ,MAAM,gBAAgB,MAAM,QAAQ,MAAM,IAAI,EAAE,aAAa,QAAc,MAAM,WAAW,QAAc,KAAK,CAAC;AAAA,EAExH,QAAQ,OAAO,YAAY,MAAM,qBAAqB,aAAa,MAAM;AAAA,EACzE,IAAI,UAAU,WAAW;AAAA,IAClB,UAAU,OAAO;AAAA,EACxB;AAAA;AAGF,IAAM,uBAAuB,OAAO,eAA4B,oBAAU,mBAAmB,aAA+B;AAAA,EAC1H,QAAQ,OAAO,YAAY,MAAM,8BAA8B,aAAa,MAAM;AAAA,EAClF,MAAM,2BAA2B,MAAM,8BAA8B,aAAa,QAAO;AAAA,EACzF,IAAI,4BAA4B,UAAU,WAAW;AAAA,IACnD;AAAA,MACE;AAA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AAO,eAA0C;AAAA,EAC3E,QAAQ,MAAM,aAAa,MAAM,QAAQ,OAAO,aAAa;AAAA,OACxD,QAAc;AAAA,IACjB,cAAc;AAAA,EAChB,CAAC;AAAA,EAED,MAAM,eAAe,SAAS,KAAK,OAAK,EAAE,MAAM,SAAS,oBAAoB,CAAC;AAAA,EAC9E,IAAI,CAAC,cAAc,MAAM;AAAA,IACvB,OAAO,CAAC;AAAA,EACV;AAAA,EAEA,MAAM,YAAY,aAAa,KAAK,MAAM,0BAA0B;AAAA,EACpE,IAAI,CAAC,YAAY,IAAI;AAAA,IACnB,OAAO,CAAC;AAAA,EACV;AAAA,EAEA,IAAI;AAAA,IACF,MAAM,SAAkB,KAAK,MAAM,UAAU,EAAE;AAAA,IAC/C,IAAI,MAAM,QAAQ,MAAM,KAAK,OAAO,MAAM,UAAQ,OAAO,SAAS,QAAQ,GAAG;AAAA,MAC3E,OAAO;AAAA,IACT;AAAA,IACA,OAAO,CAAC;AAAA,IACR,MAAM;AAAA,IACD,QAAQ,kCAAkC,oBAAoB;AAAA,IACnE,OAAO,CAAC;AAAA;AAAA;", + "debugId": "7687825B6B00F97364756E2164756E21", "names": [] } \ No newline at end of file diff --git a/src/helpers/check-merge-safety.ts b/src/helpers/check-merge-safety.ts index 0d422db2..77d1a48c 100644 --- a/src/helpers/check-merge-safety.ts +++ b/src/helpers/check-merge-safety.ts @@ -93,11 +93,8 @@ const checkForExistingFailureStatus = async (pullRequest: PullRequest, context: ...githubContext.repo, ref: pullRequest.head.sha }); - if (data.state === 'failure') { - const existingContext = data.statuses.find(status => status.context === context); - return Boolean(existingContext); - } - return false; + const existingContext = data.statuses.find(status => status.context === context); + return existingContext?.state === 'failure'; }; const fetchSha = async (repoUrl: string, sha: string) => { diff --git a/test/helpers/check-merge-safety.test.ts b/test/helpers/check-merge-safety.test.ts index 3884b9fc..cd0ddfe7 100644 --- a/test/helpers/check-merge-safety.test.ts +++ b/test/helpers/check-merge-safety.test.ts @@ -334,7 +334,7 @@ describe('checkMergeSafety', () => { const changedFilesOnPr = ['packages/package-1/src/some-file.ts']; mockGithubRequests(filesOutOfDate, changedFilesOnPr); (octokit.repos.getCombinedStatusForRef as unknown as Mock).mockResolvedValue({ - data: { state: 'failure', statuses: [{ context: 'Merge Safety' }] } + data: { state: 'failure', statuses: [{ context: 'Merge Safety', state: 'failure' }] } }); await checkMergeSafety({ paths: allProjectPaths, @@ -367,6 +367,36 @@ describe('checkMergeSafety', () => { expect(core.setFailed).toHaveBeenCalledWith('This branch has one or more outdated projects. Please update with main.'); }); + it('should set failure status for custom context even when another context is already failing', async () => { + const filesOutOfDate = ['packages/package-1/src/another-file.ts']; + const changedFilesOnPr = ['packages/package-1/src/some-file.ts']; + mockGithubRequests(filesOutOfDate, changedFilesOnPr); + (octokit.repos.getCombinedStatusForRef as unknown as Mock).mockResolvedValue({ + data: { + state: 'failure', + statuses: [ + { context: 'Merge Safety - iOS', state: 'failure' }, + { context: 'Merge Safety', state: 'success' } + ] + } + }); + await checkMergeSafety({ + paths: allProjectPaths, + context: 'Merge Safety', + ...context.repo + }); + expect(octokit.repos.createCommitStatus).toHaveBeenCalledWith({ + sha, + state: 'failure', + context: 'Merge Safety', + description: 'This branch has one or more outdated projects. Please update with main.', + target_url: 'https://github.com/owner/repo/actions/runs/123', + repo: 'repo', + owner: 'owner' + }); + expect(core.setFailed).toHaveBeenCalledWith('This branch has one or more outdated projects. Please update with main.'); + }); + it('should prevent merge when branch is out of date on override filter paths, even when changed project paths are up to date', async () => { const filesOutOfDate = ['packages/package-2/src/file1.ts', 'package.json']; const changedFilesOnPr = ['packages/package-1/src/some-file.ts'];