Skip to content

Commit

Permalink
fix(fail): properly parse issue creation response to log in terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasSchubert committed Feb 20, 2024
1 parent 6e0aee6 commit 4014f51
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/fail.js
Expand Up @@ -53,10 +53,12 @@ export default async (pluginConfig, context) => {
debug("create issue: %O", newIssue);

/* eslint camelcase: off */
const { id, web_url } = await got.post(issuesEndpoint, {
...apiOptions,
json: newIssue,
});
const { id, web_url } = await got
.post(issuesEndpoint, {
...apiOptions,
json: newIssue,
})
.json();
logger.log("Created issue #%d: %s.", id, web_url);
}
}
Expand Down
7 changes: 6 additions & 1 deletion test/fail.test.js
Expand Up @@ -72,11 +72,16 @@ Your **[semantic-release](https://github.com/semantic-release/semantic-release)*
labels: "semantic-release",
title: "The automated release is failing 🚨",
})
.reply(200);
.reply(200, { id: 3, web_url: "https://gitlab.com/test_user/test_repo/-/issues/3" });

await fail(pluginConfig, { env, options, branch, errors, logger: t.context.logger });

t.true(gitlab.isDone());
t.deepEqual(t.context.log.args[0], [
"Created issue #%d: %s.",
3,
"https://gitlab.com/test_user/test_repo/-/issues/3",
]);
});

test.serial("Post comments to existing issue", async (t) => {
Expand Down

0 comments on commit 4014f51

Please sign in to comment.