feat(plugin-scaffolder-backend-module-gitlab): add gitlab issue iid in the output
Signed-off-by: Thomas GRUSON <thomgrus@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend-module-gitlab': minor
|
||||
---
|
||||
|
||||
Add a mapping from gitlab create issue API to also output the issue iid (id scoped to the gitlab project) in the output of the scaffolder.
|
||||
@@ -70,6 +70,7 @@ describe('gitlab:issues:create', () => {
|
||||
|
||||
mockGitlabClient.Issues.create.mockResolvedValue({
|
||||
id: 42,
|
||||
iid: 1,
|
||||
web_url: 'https://gitlab.com/hangar18-/issues/42',
|
||||
});
|
||||
|
||||
@@ -97,6 +98,7 @@ describe('gitlab:issues:create', () => {
|
||||
);
|
||||
|
||||
expect(mockContext.output).toHaveBeenCalledWith('issueId', 42);
|
||||
expect(mockContext.output).toHaveBeenCalledWith('issueIid', 1);
|
||||
expect(mockContext.output).toHaveBeenCalledWith(
|
||||
'issueUrl',
|
||||
'https://gitlab.com/hangar18-/issues/42',
|
||||
@@ -116,6 +118,7 @@ describe('gitlab:issues:create', () => {
|
||||
|
||||
mockGitlabClient.Issues.create.mockResolvedValue({
|
||||
id: 42,
|
||||
iid: 1,
|
||||
web_url: 'https://gitlab.com/hangar18-/issues/42',
|
||||
});
|
||||
|
||||
@@ -143,6 +146,7 @@ describe('gitlab:issues:create', () => {
|
||||
);
|
||||
|
||||
expect(mockContext.output).toHaveBeenCalledWith('issueId', 42);
|
||||
expect(mockContext.output).toHaveBeenCalledWith('issueIid', 1);
|
||||
expect(mockContext.output).toHaveBeenCalledWith(
|
||||
'issueUrl',
|
||||
'https://gitlab.com/hangar18-/issues/42',
|
||||
@@ -168,6 +172,7 @@ describe('gitlab:issues:create', () => {
|
||||
|
||||
mockGitlabClient.Issues.create.mockResolvedValue({
|
||||
id: 42,
|
||||
iid: 1,
|
||||
web_url: 'https://gitlab.com/hangar18-/issues/42',
|
||||
});
|
||||
|
||||
@@ -196,6 +201,7 @@ describe('gitlab:issues:create', () => {
|
||||
);
|
||||
|
||||
expect(mockContext.output).toHaveBeenCalledWith('issueId', 42);
|
||||
expect(mockContext.output).toHaveBeenCalledWith('issueIid', 1);
|
||||
expect(mockContext.output).toHaveBeenCalledWith(
|
||||
'issueUrl',
|
||||
'https://gitlab.com/hangar18-/issues/42',
|
||||
|
||||
@@ -102,6 +102,7 @@ const issueInputProperties = z.object({
|
||||
const issueOutputProperties = z.object({
|
||||
issueUrl: z.string({ description: 'Issue Url' }),
|
||||
issueId: z.number({ description: 'Issue Id' }),
|
||||
issueIid: z.number({ description: 'Issue Iid' }),
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -194,6 +195,7 @@ export const createGitlabIssueAction = (options: {
|
||||
|
||||
ctx.output('issueId', response.id);
|
||||
ctx.output('issueUrl', response.web_url);
|
||||
ctx.output('issueIid', response.iid);
|
||||
} catch (error: any) {
|
||||
if (error instanceof z.ZodError) {
|
||||
// Handling Zod validation errors
|
||||
|
||||
Reference in New Issue
Block a user