Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/success.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ export default async function success(pluginConfig, context, { Octokit }) {

if (failComment === false || failTitle === false) {
logger.log("Skip closing issue.");
logger.warn(
`DEPRECATION: 'false' for 'failComment' or 'failTitle' is deprecated and will be removed in a future major version. Use 'failCommentCondition' instead.`,
);
} else if (failCommentCondition === false) {
logger.log("Skip closing issue.");
} else {
const srIssues = await findSRIssues(
octokit,
Expand Down
57 changes: 57 additions & 0 deletions test/success.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4414,3 +4414,60 @@ test('Skip closing issues if "failTitle" is "false"', async (t) => {
t.true(t.context.log.calledWith("Skip closing issue."));
t.true(fetch.done());
});

test('Skip closing issues if "failCommentCondition" is "false"', async (t) => {
const owner = "test_user";
const repo = "test_repo";
const env = { GITHUB_TOKEN: "github_token" };
const pluginConfig = { failCommentCondition: false };
const options = { repositoryUrl: `https://github.com/${owner}/${repo}.git` };
const commits = [{ hash: "123", message: "Commit 1 message" }];
const nextRelease = { version: "1.0.0" };
const releases = [
{ name: "GitHub release", url: "https://github.com/release" },
];

const fetch = fetchMock
.sandbox()
.getOnce(`https://api.github.local/repos/${owner}/${repo}`, {
full_name: `${owner}/${repo}`,
clone_url: `https://api.github.local/${owner}/${repo}.git`,
})
.postOnce("https://api.github.local/graphql", {
data: {
repository: {
commit123: {
oid: "123",
associatedPullRequests: {
pageInfo: {
endCursor: "NI",
hasNextPage: false,
},
nodes: [],
},
},
},
},
});

await success(
pluginConfig,
{
env,
options,
branch: { name: "master" },
commits,
nextRelease,
releases,
logger: t.context.logger,
},
{
Octokit: TestOctokit.defaults((options) => ({
...options,
request: { ...options.request, fetch },
})),
},
);
t.true(t.context.log.calledWith("Skip closing issue."));
t.true(fetch.done());
});