@backstage/plugin-scaffolder-backend 1.5.0-next.1 → 1.5.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +5 -2
- package/dist/index.beta.d.ts +5 -2
- package/dist/index.cjs.js +53 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.5.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 692d5d3405: Added `reviewers` and `teamReviewers` parameters to `publish:github:pull-request` action to add reviewers on the pull request created by the action
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/plugin-catalog-backend@1.3.1-next.2
|
|
13
|
+
|
|
3
14
|
## 1.5.0-next.1
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { Knex } from 'knex';
|
|
|
21
21
|
import { LocationSpec } from '@backstage/plugin-catalog-backend';
|
|
22
22
|
import { Logger } from 'winston';
|
|
23
23
|
import { Observable } from '@backstage/types';
|
|
24
|
+
import { Octokit } from 'octokit';
|
|
24
25
|
import { PluginDatabaseManager } from '@backstage/backend-common';
|
|
25
26
|
import { Schema } from 'jsonschema';
|
|
26
27
|
import { ScmIntegrationRegistry } from '@backstage/integration';
|
|
@@ -513,6 +514,8 @@ draft?: boolean | undefined;
|
|
|
513
514
|
targetPath?: string | undefined;
|
|
514
515
|
sourcePath?: string | undefined;
|
|
515
516
|
token?: string | undefined;
|
|
517
|
+
reviewers?: string[] | undefined;
|
|
518
|
+
teamReviewers?: string[] | undefined;
|
|
516
519
|
}>;
|
|
517
520
|
|
|
518
521
|
/**
|
|
@@ -676,14 +679,14 @@ export declare function fetchContents({ reader, integrations, baseUrl, fetchUrl,
|
|
|
676
679
|
}): Promise<void>;
|
|
677
680
|
|
|
678
681
|
/** @public */
|
|
679
|
-
export declare
|
|
682
|
+
export declare type OctokitWithPullRequestPluginClient = Octokit & {
|
|
680
683
|
createPullRequest(options: createPullRequest.Options): Promise<{
|
|
681
684
|
data: {
|
|
682
685
|
html_url: string;
|
|
683
686
|
number: number;
|
|
684
687
|
};
|
|
685
688
|
} | null>;
|
|
686
|
-
}
|
|
689
|
+
};
|
|
687
690
|
|
|
688
691
|
/**
|
|
689
692
|
* RouterOptions
|
package/dist/index.beta.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { Knex } from 'knex';
|
|
|
21
21
|
import { LocationSpec } from '@backstage/plugin-catalog-backend';
|
|
22
22
|
import { Logger } from 'winston';
|
|
23
23
|
import { Observable } from '@backstage/types';
|
|
24
|
+
import { Octokit } from 'octokit';
|
|
24
25
|
import { PluginDatabaseManager } from '@backstage/backend-common';
|
|
25
26
|
import { Schema } from 'jsonschema';
|
|
26
27
|
import { ScmIntegrationRegistry } from '@backstage/integration';
|
|
@@ -513,6 +514,8 @@ draft?: boolean | undefined;
|
|
|
513
514
|
targetPath?: string | undefined;
|
|
514
515
|
sourcePath?: string | undefined;
|
|
515
516
|
token?: string | undefined;
|
|
517
|
+
reviewers?: string[] | undefined;
|
|
518
|
+
teamReviewers?: string[] | undefined;
|
|
516
519
|
}>;
|
|
517
520
|
|
|
518
521
|
/**
|
|
@@ -676,14 +679,14 @@ export declare function fetchContents({ reader, integrations, baseUrl, fetchUrl,
|
|
|
676
679
|
}): Promise<void>;
|
|
677
680
|
|
|
678
681
|
/** @public */
|
|
679
|
-
export declare
|
|
682
|
+
export declare type OctokitWithPullRequestPluginClient = Octokit & {
|
|
680
683
|
createPullRequest(options: createPullRequest.Options): Promise<{
|
|
681
684
|
data: {
|
|
682
685
|
html_url: string;
|
|
683
686
|
number: number;
|
|
684
687
|
};
|
|
685
688
|
} | null>;
|
|
686
|
-
}
|
|
689
|
+
};
|
|
687
690
|
|
|
688
691
|
/**
|
|
689
692
|
* RouterOptions
|
package/dist/index.cjs.js
CHANGED
|
@@ -3055,6 +3055,22 @@ const createPublishGithubPullRequestAction = ({
|
|
|
3055
3055
|
title: "Authentication Token",
|
|
3056
3056
|
type: "string",
|
|
3057
3057
|
description: "The token to use for authorization to GitHub"
|
|
3058
|
+
},
|
|
3059
|
+
reviewers: {
|
|
3060
|
+
title: "Pull Request Reviewers",
|
|
3061
|
+
type: "array",
|
|
3062
|
+
items: {
|
|
3063
|
+
type: "string"
|
|
3064
|
+
},
|
|
3065
|
+
description: "The users that will be added as reviewers to the pull request"
|
|
3066
|
+
},
|
|
3067
|
+
teamReviewers: {
|
|
3068
|
+
title: "Pull Request Team Reviewers",
|
|
3069
|
+
type: "array",
|
|
3070
|
+
items: {
|
|
3071
|
+
type: "string"
|
|
3072
|
+
},
|
|
3073
|
+
description: "The teams that will be added as reviewers to the pull request"
|
|
3058
3074
|
}
|
|
3059
3075
|
}
|
|
3060
3076
|
},
|
|
@@ -3084,7 +3100,9 @@ const createPublishGithubPullRequestAction = ({
|
|
|
3084
3100
|
draft,
|
|
3085
3101
|
targetPath,
|
|
3086
3102
|
sourcePath,
|
|
3087
|
-
token: providedToken
|
|
3103
|
+
token: providedToken,
|
|
3104
|
+
reviewers,
|
|
3105
|
+
teamReviewers
|
|
3088
3106
|
} = ctx.input;
|
|
3089
3107
|
const { owner, repo, host } = parseRepoUrl(repoUrl, integrations);
|
|
3090
3108
|
if (!owner) {
|
|
@@ -3132,13 +3150,46 @@ const createPublishGithubPullRequestAction = ({
|
|
|
3132
3150
|
if (!response) {
|
|
3133
3151
|
throw new GithubResponseError("null response from Github");
|
|
3134
3152
|
}
|
|
3153
|
+
const pullRequestNumber = response.data.number;
|
|
3154
|
+
if (reviewers || teamReviewers) {
|
|
3155
|
+
const pullRequest = { owner, repo, number: pullRequestNumber };
|
|
3156
|
+
await requestReviewersOnPullRequest(
|
|
3157
|
+
pullRequest,
|
|
3158
|
+
reviewers,
|
|
3159
|
+
teamReviewers,
|
|
3160
|
+
client,
|
|
3161
|
+
ctx.logger
|
|
3162
|
+
);
|
|
3163
|
+
}
|
|
3135
3164
|
ctx.output("remoteUrl", response.data.html_url);
|
|
3136
|
-
ctx.output("pullRequestNumber",
|
|
3165
|
+
ctx.output("pullRequestNumber", pullRequestNumber);
|
|
3137
3166
|
} catch (e) {
|
|
3138
3167
|
throw new GithubResponseError("Pull request creation failed", e);
|
|
3139
3168
|
}
|
|
3140
3169
|
}
|
|
3141
3170
|
});
|
|
3171
|
+
async function requestReviewersOnPullRequest(pr, reviewers, teamReviewers, client, logger) {
|
|
3172
|
+
var _a, _b, _c, _d;
|
|
3173
|
+
try {
|
|
3174
|
+
const result = await client.rest.pulls.requestReviewers({
|
|
3175
|
+
owner: pr.owner,
|
|
3176
|
+
repo: pr.repo,
|
|
3177
|
+
pull_number: pr.number,
|
|
3178
|
+
reviewers,
|
|
3179
|
+
team_reviewers: teamReviewers
|
|
3180
|
+
});
|
|
3181
|
+
const addedUsers = (_b = (_a = result.data.requested_reviewers) == null ? void 0 : _a.join(", ")) != null ? _b : "";
|
|
3182
|
+
const addedTeams = (_d = (_c = result.data.requested_teams) == null ? void 0 : _c.join(", ")) != null ? _d : "";
|
|
3183
|
+
logger.info(
|
|
3184
|
+
`Added users [${addedUsers}] and teams [${addedTeams}] as reviewers to Pull request ${pr.number}`
|
|
3185
|
+
);
|
|
3186
|
+
} catch (e) {
|
|
3187
|
+
logger.error(
|
|
3188
|
+
`Failure when adding reviewers to Pull request ${pr.number}`,
|
|
3189
|
+
e
|
|
3190
|
+
);
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3142
3193
|
};
|
|
3143
3194
|
|
|
3144
3195
|
function createPublishGitlabAction(options) {
|