From b98d511b6149211151b9c6cc83d0d9c371dcf8f1 Mon Sep 17 00:00:00 2001 From: Matt Benson Date: Sat, 8 Feb 2025 21:27:25 -0600 Subject: [PATCH] clean up github action schemas Signed-off-by: Matt Benson --- .changeset/hungry-buckets-visit.md | 5 ++ .../src/actions/githubActionsDispatch.ts | 6 +- .../src/actions/githubAutolinks.ts | 8 +- .../src/actions/githubDeployKey.ts | 11 ++- .../src/actions/githubEnvironment.ts | 16 ++-- .../src/actions/githubIssuesLabel.ts | 6 +- .../src/actions/githubPagesEnable.ts | 10 ++- .../src/actions/githubPullRequest.ts | 9 ++- .../src/actions/githubWebhook.ts | 21 ++++-- .../src/actions/inputProperties.ts | 74 ++++++++++++++----- 10 files changed, 117 insertions(+), 49 deletions(-) create mode 100644 .changeset/hungry-buckets-visit.md diff --git a/.changeset/hungry-buckets-visit.md b/.changeset/hungry-buckets-visit.md new file mode 100644 index 0000000000..59221ea07b --- /dev/null +++ b/.changeset/hungry-buckets-visit.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend-module-github': patch +--- + +clean up github action schemas diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubActionsDispatch.ts b/plugins/scaffolder-backend-module-github/src/actions/githubActionsDispatch.ts index 93f89a565c..8e185a9567 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubActionsDispatch.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubActionsDispatch.ts @@ -55,7 +55,8 @@ export function createGithubActionsDispatchAction(options: { properties: { repoUrl: { title: 'Repository Location', - description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`, + description: + 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username', type: 'string', }, workflowId: { @@ -78,7 +79,8 @@ export function createGithubActionsDispatchAction(options: { token: { title: 'Authentication Token', type: 'string', - description: 'The GITHUB_TOKEN to use for authorization to GitHub', + description: + 'The `GITHUB_TOKEN` to use for authorization to GitHub', }, }, }, diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubAutolinks.ts b/plugins/scaffolder-backend-module-github/src/actions/githubAutolinks.ts index b55811630b..85c7f5da6f 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubAutolinks.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubAutolinks.ts @@ -54,7 +54,8 @@ export function createGithubAutolinksAction(options: { properties: { repoUrl: { title: 'Repository Location', - description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`, + description: + 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username', type: 'string', }, keyPrefix: { @@ -66,14 +67,15 @@ export function createGithubAutolinksAction(options: { urlTemplate: { title: 'URL Template', description: - 'The URL must contain for the reference number. matches different characters depending on the value of isAlphanumeric.', + 'The URL must contain `` for the reference number. `` matches different characters depending on the value of isAlphanumeric.', type: 'string', }, isAlphanumeric: { title: 'Alphanumeric', description: - 'Whether this autolink reference matches alphanumeric characters. If true, the parameter of the url_template matches alphanumeric characters A-Z (case insensitive), 0-9, and -. If false, this autolink reference only matches numeric characters. Default: true', + 'Whether this autolink reference matches alphanumeric characters. If `true`, the `` parameter of the `url_template` matches alphanumeric characters `A-Z` (case insensitive), `0-9`, and `-`. If `false`, this autolink reference only matches numeric characters. Default: `true`', type: 'boolean', + default: true, }, token: { title: 'Authentication Token', diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubDeployKey.ts b/plugins/scaffolder-backend-module-github/src/actions/githubDeployKey.ts index a91ac8ba5e..7e674a3e52 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubDeployKey.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubDeployKey.ts @@ -54,17 +54,19 @@ export function createGithubDeployKeyAction(options: { properties: { repoUrl: { title: 'Repository Location', - description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`, + description: + 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username', type: 'string', }, publicKey: { title: 'SSH Public Key', - description: `Generated from ssh-keygen. Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'.`, + description: + 'Generated from `ssh-keygen`. Begins with `ssh-rsa`, `ecdsa-sha2-nistp256`, `ecdsa-sha2-nistp384`, `ecdsa-sha2-nistp521`, `ssh-ed25519`, `sk-ecdsa-sha2-nistp256@openssh.com`, or `sk-ssh-ed25519@openssh.com`.', type: 'string', }, privateKey: { title: 'SSH Private Key', - description: `SSH Private Key generated from ssh-keygen`, + description: 'SSH Private Key generated from `ssh-keygen`', type: 'string', }, deployKeyName: { @@ -74,7 +76,8 @@ export function createGithubDeployKeyAction(options: { }, privateKeySecretName: { title: 'Private Key GitHub Secret Name', - description: `Name of the GitHub Secret to store the private key related to the Deploy Key. Defaults to: 'KEY_NAME_PRIVATE_KEY' where 'KEY_NAME' is the name of the Deploy Key`, + description: + 'Name of the GitHub Secret to store the private key related to the Deploy Key. Defaults to: `KEY_NAME_PRIVATE_KEY` where `KEY_NAME` is the name of the Deploy Key', type: 'string', }, token: { diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.ts b/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.ts index 49bd96db9d..a9a8b86da4 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubEnvironment.ts @@ -67,7 +67,8 @@ export function createGithubEnvironmentAction(options: { properties: { repoUrl: { title: 'Repository Location', - description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`, + description: + 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username', type: 'string', }, name: { @@ -77,18 +78,21 @@ export function createGithubEnvironmentAction(options: { }, deploymentBranchPolicy: { title: 'Deployment Branch Policy', - description: `The type of deployment branch policy for this environment. To allow all branches to deploy, set to null.`, + description: + 'The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`.', type: 'object', required: ['protected_branches', 'custom_branch_policies'], properties: { protected_branches: { title: 'Protected Branches', - description: `Whether only branches with branch protection rules can deploy to this environment. If protected_branches is true, custom_branch_policies must be false; if protected_branches is false, custom_branch_policies must be true.`, + description: + 'Whether only branches with branch protection rules can deploy to this environment. If `protected_branches` is `true`, `custom_branch_policies` must be `false`; if `protected_branches` is `false`, `custom_branch_policies` must be `true`.', type: 'boolean', }, custom_branch_policies: { title: 'Custom Branch Policies', - description: `Whether only branches that match the specified name patterns can deploy to this environment. If custom_branch_policies is true, protected_branches must be false; if custom_branch_policies is false, protected_branches must be true.`, + description: + 'Whether only branches that match the specified name patterns can deploy to this environment. If `custom_branch_policies` is `true`, `protected_branches` must be `false`; if `custom_branch_policies` is `false`, `protected_branches` must be `true`.', type: 'boolean', }, }, @@ -97,7 +101,7 @@ export function createGithubEnvironmentAction(options: { title: 'Custom Branch Policy Name', description: `The name pattern that branches must match in order to deploy to the environment. - Wildcard characters will not match /. For example, to match branches that begin with release/ and contain an additional single slash, use release/*/*. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`, +Wildcard characters will not match \`/\`. For example, to match branches that begin with \`release/\` and contain an additional single slash, use \`release/*/*\`. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`, type: 'array', items: { type: 'string', @@ -107,7 +111,7 @@ export function createGithubEnvironmentAction(options: { title: 'Custom Tag Policy Name', description: `The name pattern that tags must match in order to deploy to the environment. - Wildcard characters will not match /. For example, to match tags that begin with release/ and contain an additional single slash, use release/*/*. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`, +Wildcard characters will not match \`/\`. For example, to match tags that begin with \`release/\` and contain an additional single slash, use \`release/*/*\`. For more information about pattern matching syntax, see the Ruby File.fnmatch documentation.`, type: 'array', items: { type: 'string', diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubIssuesLabel.ts b/plugins/scaffolder-backend-module-github/src/actions/githubIssuesLabel.ts index 0ce6642f39..8bba9f244b 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubIssuesLabel.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubIssuesLabel.ts @@ -53,7 +53,8 @@ export function createGithubIssuesLabelAction(options: { properties: { repoUrl: { title: 'Repository Location', - description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the repository name and 'owner' is an organization or username`, + description: + 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the repository name and `owner` is an organization or username', type: 'string', }, number: { @@ -72,7 +73,8 @@ export function createGithubIssuesLabelAction(options: { token: { title: 'Authentication Token', type: 'string', - description: 'The GITHUB_TOKEN to use for authorization to GitHub', + description: + 'The `GITHUB_TOKEN` to use for authorization to GitHub', }, }, }, diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubPagesEnable.ts b/plugins/scaffolder-backend-module-github/src/actions/githubPagesEnable.ts index 9212f77338..7a676b52f2 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubPagesEnable.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubPagesEnable.ts @@ -55,25 +55,31 @@ export function createGithubPagesEnableAction(options: { properties: { repoUrl: { title: 'Repository Location', - description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`, + description: + 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username', type: 'string', }, buildType: { title: 'Build Type', type: 'string', + default: 'workflow', description: - 'The GitHub Pages build type - "legacy" or "workflow". Default is "workflow', + 'The GitHub Pages build type - `legacy` or `workflow`. Default is `workflow`', + enum: ['legacy', 'workflow'], }, sourceBranch: { title: 'Source Branch', type: 'string', + default: 'main', description: 'The GitHub Pages source branch. Default is "main"', }, sourcePath: { title: 'Source Path', type: 'string', + default: '/', description: 'The GitHub Pages source path - "/" or "/docs". Default is "/"', + enum: ['/', '/docs'], }, token: { title: 'Authorization Token', diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.ts b/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.ts index c9a1b3d1b5..5922c4e149 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.ts @@ -157,7 +157,8 @@ export const createPublishGithubPullRequestAction = ( properties: { repoUrl: { title: 'Repository Location', - description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the repository name and 'owner' is an organization or username`, + description: + 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the repository name and `owner` is an organization or username', type: 'string', }, branchName: { @@ -168,7 +169,7 @@ export const createPublishGithubPullRequestAction = ( targetBranchName: { type: 'string', title: 'Target Branch Name', - description: 'The target branch name of the merge request', + description: 'The target branch name of the pull request', }, title: { type: 'string', @@ -238,13 +239,13 @@ export const createPublishGithubPullRequestAction = ( type: 'string', title: 'Default Author Name', description: - "Sets the default author name for the commit. The default value is the authenticated user or 'Scaffolder'", + 'Sets the default author name for the commit. The default value is the authenticated user or `Scaffolder`', }, gitAuthorEmail: { type: 'string', title: 'Default Author Email', description: - "Sets the default author email for the commit. The default value is the authenticated user or 'scaffolder@backstage.io'", + 'Sets the default author email for the commit. The default value is the authenticated user or `scaffolder@backstage.io`', }, forceEmptyGitAuthor: { type: 'boolean', diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubWebhook.ts b/plugins/scaffolder-backend-module-github/src/actions/githubWebhook.ts index 13200a56d0..50ae7cd9b8 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubWebhook.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubWebhook.ts @@ -63,7 +63,8 @@ export function createGithubWebhookAction(options: { properties: { repoUrl: { title: 'Repository Location', - description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`, + description: + 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username', type: 'string', }, webhookUrl: { @@ -80,8 +81,9 @@ export function createGithubWebhookAction(options: { events: { title: 'Triggering Events', description: - 'Determines what events the hook is triggered for. Default: push', + 'Determines what events the hook is triggered for. Default: `[push]`', type: 'array', + default: ['push'], oneOf: [ { items: { @@ -100,23 +102,30 @@ export function createGithubWebhookAction(options: { active: { title: 'Active', type: 'boolean', - description: `Determines if notifications are sent when the webhook is triggered. Default: true`, + default: true, + description: + 'Determines if notifications are sent when the webhook is triggered. Default: `true`', }, contentType: { title: 'Content Type', type: 'string', enum: ['form', 'json'], - description: `The media type used to serialize the payloads. The default is 'form'`, + default: 'form', + description: + 'The media type used to serialize the payloads. The default is `form`', }, insecureSsl: { title: 'Insecure SSL', type: 'boolean', - description: `Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Default 'false'`, + default: false, + description: + 'Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Default `false`', }, token: { title: 'Authentication Token', type: 'string', - description: 'The GITHUB_TOKEN to use for authorization to GitHub', + description: + 'The `GITHUB_TOKEN` to use for authorization to GitHub', }, }, }, diff --git a/plugins/scaffolder-backend-module-github/src/actions/inputProperties.ts b/plugins/scaffolder-backend-module-github/src/actions/inputProperties.ts index 8b30168225..29e426d2b9 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/inputProperties.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/inputProperties.ts @@ -16,7 +16,8 @@ const repoUrl = { title: 'Repository Location', - description: `Accepts the format 'github.com?repo=reponame&owner=owner' where 'reponame' is the new repository name and 'owner' is an organization or username`, + description: + 'Accepts the format `github.com?repo=reponame&owner=owner` where `reponame` is the new repository name and `owner` is an organization or username', type: 'string', }; const description = { @@ -29,7 +30,8 @@ const homepage = { }; const access = { title: 'Repository Access', - description: `Sets an admin collaborator on the repository. Can either be a user reference different from 'owner' in 'repoUrl' or team reference, eg. 'org/team-name'`, + description: + 'Sets an admin collaborator on the repository. Can either be a user reference different from `owner` in `repoUrl` or team reference, eg. `org/team-name`', type: 'string', }; const requireCodeOwnerReviews = { @@ -55,8 +57,10 @@ const requiredStatusCheckContexts = { }; const requireBranchesToBeUpToDate = { title: 'Require Branches To Be Up To Date?', - description: `Require branches to be up to date before merging. The default value is 'true'`, + description: + 'Require branches to be up to date before merging. The default value is `true`', type: 'boolean', + default: true, }; const requiredConversationResolution = { title: 'Required Conversation Resolution', @@ -67,7 +71,9 @@ const requiredConversationResolution = { const requireLastPushApproval = { title: 'Require last push approval', type: 'boolean', - description: `Whether the most recent push to a PR must be approved by someone other than the person who pushed it. The default value is 'false'`, + default: false, + description: + 'Whether the most recent push to a PR must be approved by someone other than the person who pushed it. The default value is `false`', }; const repoVisibility = { title: 'Repository Visibility', @@ -77,12 +83,16 @@ const repoVisibility = { const deleteBranchOnMerge = { title: 'Delete Branch On Merge', type: 'boolean', - description: `Delete the branch after merging the PR. The default value is 'false'`, + default: false, + description: + 'Delete the branch after merging the PR. The default value is `false`', }; const gitAuthorName = { title: 'Default Author Name', type: 'string', - description: `Sets the default author name for the commit. The default value is 'Scaffolder'`, + default: 'Scaffolder', + description: + 'Sets the default author name for the commit. The default value is `Scaffolder`', }; const gitAuthorEmail = { title: 'Default Author Email', @@ -92,33 +102,44 @@ const gitAuthorEmail = { const allowMergeCommit = { title: 'Allow Merge Commits', type: 'boolean', - description: `Allow merge commits. The default value is 'true'`, + default: true, + description: 'Allow merge commits. The default value is `true`', }; const allowSquashMerge = { title: 'Allow Squash Merges', type: 'boolean', - description: `Allow squash merges. The default value is 'true'`, + default: true, + description: 'Allow squash merges. The default value is `true`', }; const squashMergeCommitTitle = { title: 'Default squash merge commit title', enum: ['PR_TITLE', 'COMMIT_OR_PR_TITLE'], - description: `Sets the default value for a squash merge commit title. The default value is 'COMMIT_OR_PR_TITLE'`, + type: 'string', + default: 'COMMIT_OR_PR_TITLE', + description: + 'Sets the default value for a squash merge commit title. The default value is `COMMIT_OR_PR_TITLE`', }; const squashMergeCommitMessage = { title: 'Default squash merge commit message', enum: ['PR_BODY', 'COMMIT_MESSAGES', 'BLANK'], - description: `Sets the default value for a squash merge commit message. The default value is 'COMMIT_MESSAGES'`, + type: 'string', + default: 'COMMIT_MESSAGES', + description: + 'Sets the default value for a squash merge commit message. The default value is `COMMIT_MESSAGES`', }; const allowRebaseMerge = { title: 'Allow Rebase Merges', type: 'boolean', - description: `Allow rebase merges. The default value is 'true'`, + default: true, + description: 'Allow rebase merges. The default value is `true`', }; const allowAutoMerge = { title: 'Allow Auto Merges', type: 'boolean', - description: `Allow individual PRs to merge automatically when all merge requirements are met. The default value is 'false'`, + default: false, + description: + 'Allow individual PRs to merge automatically when all merge requirements are met. The default value is `false`', }; const collaborators = { title: 'Collaborators', @@ -150,17 +171,21 @@ const collaborators = { const hasProjects = { title: 'Enable projects', type: 'boolean', - description: `Enable projects for the repository. The default value is 'true' unless the organization has disabled repository projects`, + description: + 'Enable projects for the repository. The default value is `true` unless the organization has disabled repository projects', }; const hasWiki = { title: 'Enable the wiki', type: 'boolean', - description: `Enable the wiki for the repository. The default value is 'true'`, + default: true, + description: + 'Enable the wiki for the repository. The default value is `true`', }; const hasIssues = { title: 'Enable issues', type: 'boolean', - description: `Enable issues for the repository. The default value is 'true'`, + default: true, + description: 'Enable issues for the repository. The default value is `true`', }; const token = { title: 'Authentication Token', @@ -177,17 +202,23 @@ const topics = { const defaultBranch = { title: 'Default Branch', type: 'string', - description: `Sets the default branch on the repository. The default value is 'master'`, + default: 'master', + description: + 'Sets the default branch on the repository. The default value is `master`', }; const protectDefaultBranch = { title: 'Protect Default Branch', type: 'boolean', - description: `Protect the default branch after creating the repository. The default value is 'true'`, + default: true, + description: + 'Protect the default branch after creating the repository. The default value is `true`', }; const protectEnforceAdmins = { title: 'Enforce Admins On Protected Branches', type: 'boolean', - description: `Enforce admins to adhere to default branch protection. The default value is 'true'`, + default: true, + description: + 'Enforce admins to adhere to default branch protection. The default value is `true`', }; const bypassPullRequestAllowances = { @@ -221,7 +252,9 @@ const bypassPullRequestAllowances = { const gitCommitMessage = { title: 'Git Commit Message', type: 'string', - description: `Sets the commit message on the repository. The default value is 'initial commit'`, + default: 'initial commit', + description: + 'Sets the commit message on the repository. The default value is `initial commit`', }; const sourcePath = { title: 'Source Path', @@ -233,7 +266,8 @@ const sourcePath = { const requiredApprovingReviewCount = { title: 'Required approving review count', type: 'number', - description: `Specify the number of reviewers required to approve pull requests. Use a number between 1 and 6 or 0 to not require reviewers. Defaults to 1.`, + description: + 'Specify the number of reviewers required to approve pull requests. Use a number between `1` and `6` or `0` to not require reviewers. Defaults to `1`.', }; const restrictions = {