Skip to content

Commit

Permalink
Merge pull request #680 from JonasSchubert/fix/properly-parse-create-…
Browse files Browse the repository at this point in the history
…fail-issue

fix(fail): properly parse issue creation response to log in terminal
  • Loading branch information
fgreinacher authored Feb 20, 2024
2 parents 6e0aee6 + 4014f51 commit 142dd15
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 142dd15

Please sign in to comment.