@backstage/plugin-scaffolder-backend 0.18.0 → 1.0.0

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - b58c70c223: This package has been promoted to v1.0! To understand how this change affects the package, please check out our [versioning policy](https://backstage.io/docs/overview/versioning-policy).
8
+
9
+ ### Patch Changes
10
+
11
+ - 765639f98c: Added new `github:issues:label` action to apply labels to issues, and also output `pullRequestNumber` from `publish:github:pull-request`.
12
+ - efc73db10c: Use `better-sqlite3` instead of `@vscode/sqlite3`
13
+ - c8475ab3bb: Adding some documentation for exported things
14
+ - f24ef7864e: Minor typo fixes
15
+ - Updated dependencies
16
+ - @backstage/plugin-catalog-backend@1.0.0
17
+ - @backstage/backend-common@0.13.1
18
+ - @backstage/catalog-model@1.0.0
19
+ - @backstage/plugin-scaffolder-common@1.0.0
20
+ - @backstage/integration@1.0.0
21
+ - @backstage/catalog-client@1.0.0
22
+ - @backstage/config@1.0.0
23
+ - @backstage/errors@1.0.0
24
+ - @backstage/types@1.0.0
25
+
3
26
  ## 0.18.0
4
27
 
5
28
  ### Minor Changes
package/dist/index.cjs.js CHANGED
@@ -1553,6 +1553,11 @@ const createPublishGithubPullRequestAction = ({
1553
1553
  type: "string",
1554
1554
  title: "Pull Request URL",
1555
1555
  description: "Link to the pull request in Github"
1556
+ },
1557
+ pullRequestNumber: {
1558
+ type: "number",
1559
+ title: "Pull Request Number",
1560
+ description: "The pull request number"
1556
1561
  }
1557
1562
  }
1558
1563
  }
@@ -1619,6 +1624,7 @@ const createPublishGithubPullRequestAction = ({
1619
1624
  throw new GithubResponseError("null response from Github");
1620
1625
  }
1621
1626
  ctx.output("remoteUrl", response.data.html_url);
1627
+ ctx.output("pullRequestNumber", response.data.number);
1622
1628
  } catch (e) {
1623
1629
  throw new GithubResponseError("Pull request creation failed", e);
1624
1630
  }
@@ -2038,6 +2044,70 @@ function createGithubWebhookAction(options) {
2038
2044
  });
2039
2045
  }
2040
2046
 
2047
+ function createGithubIssuesLabelAction(options) {
2048
+ const { integrations, githubCredentialsProvider } = options;
2049
+ return createTemplateAction({
2050
+ id: "github:issues:label",
2051
+ description: "Adds labels to a pull request or issue on GitHub.",
2052
+ schema: {
2053
+ input: {
2054
+ type: "object",
2055
+ required: ["repoUrl", "number", "labels"],
2056
+ properties: {
2057
+ repoUrl: {
2058
+ title: "Repository Location",
2059
+ description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the repository name and 'owner' is an organization or username`,
2060
+ type: "string"
2061
+ },
2062
+ number: {
2063
+ title: "Pull Request or issue number",
2064
+ description: "The pull request or issue number to add labels to",
2065
+ type: "number"
2066
+ },
2067
+ labels: {
2068
+ title: "Labels",
2069
+ description: "The labels to add to the pull request or issue",
2070
+ type: "array",
2071
+ items: {
2072
+ type: "string"
2073
+ }
2074
+ },
2075
+ token: {
2076
+ title: "Authentication Token",
2077
+ type: "string",
2078
+ description: "The GITHUB_TOKEN to use for authorization to GitHub"
2079
+ }
2080
+ }
2081
+ }
2082
+ },
2083
+ async handler(ctx) {
2084
+ const { repoUrl, number, labels, token: providedToken } = ctx.input;
2085
+ const { owner, repo } = parseRepoUrl(repoUrl, integrations);
2086
+ ctx.logger.info(`Adding labels to ${number} issue on repo ${repo}`);
2087
+ if (!owner) {
2088
+ throw new errors.InputError("Invalid repository owner provided in repoUrl");
2089
+ }
2090
+ const client = new octokit.Octokit(await getOctokitOptions({
2091
+ integrations,
2092
+ credentialsProvider: githubCredentialsProvider,
2093
+ repoUrl,
2094
+ token: providedToken
2095
+ }));
2096
+ try {
2097
+ await client.rest.issues.addLabels({
2098
+ owner,
2099
+ repo,
2100
+ issue_number: number,
2101
+ labels
2102
+ });
2103
+ } catch (e) {
2104
+ errors.assertError(e);
2105
+ ctx.logger.warn(`Failed: adding labels to issue: '${number}' on repo: '${repo}', ${e.message}`);
2106
+ }
2107
+ }
2108
+ });
2109
+ }
2110
+
2041
2111
  const createBuiltinActions = (options) => {
2042
2112
  const {
2043
2113
  reader,
@@ -2093,6 +2163,10 @@ const createBuiltinActions = (options) => {
2093
2163
  createGithubWebhookAction({
2094
2164
  integrations,
2095
2165
  githubCredentialsProvider
2166
+ }),
2167
+ createGithubIssuesLabelAction({
2168
+ integrations,
2169
+ githubCredentialsProvider
2096
2170
  })
2097
2171
  ];
2098
2172
  return actions;
@@ -2950,6 +3024,7 @@ exports.createFetchTemplateAction = createFetchTemplateAction;
2950
3024
  exports.createFilesystemDeleteAction = createFilesystemDeleteAction;
2951
3025
  exports.createFilesystemRenameAction = createFilesystemRenameAction;
2952
3026
  exports.createGithubActionsDispatchAction = createGithubActionsDispatchAction;
3027
+ exports.createGithubIssuesLabelAction = createGithubIssuesLabelAction;
2953
3028
  exports.createGithubWebhookAction = createGithubWebhookAction;
2954
3029
  exports.createPublishAzureAction = createPublishAzureAction;
2955
3030
  exports.createPublishBitbucketAction = createPublishBitbucketAction;