Set defaults in action.yml
This commit is contained in:
parent
b5b1bc17a4
commit
6fa44e144d
4 changed files with 50 additions and 63 deletions
66
action.yml
66
action.yml
|
@ -2,42 +2,54 @@ name: 'Create Pull Request'
|
||||||
description: 'Creates a pull request for changes to your repository in the actions workspace'
|
description: 'Creates a pull request for changes to your repository in the actions workspace'
|
||||||
inputs:
|
inputs:
|
||||||
token:
|
token:
|
||||||
description: 'GITHUB_TOKEN or a repo scoped PAT'
|
description: 'GITHUB_TOKEN or a `repo` scoped Personal Access Token (PAT)'
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
path:
|
path:
|
||||||
description: 'Relative path under $GITHUB_WORKSPACE to the repository.'
|
description: >
|
||||||
|
Relative path under $GITHUB_WORKSPACE to the repository.
|
||||||
|
Defaults to $GITHUB_WORKSPACE.
|
||||||
commit-message:
|
commit-message:
|
||||||
description: 'The message to use when committing changes.'
|
description: 'The message to use when committing changes.'
|
||||||
|
default: '[create-pull-request] automated change'
|
||||||
committer:
|
committer:
|
||||||
description: 'The committer name and email address.'
|
description: >
|
||||||
|
The committer name and email address in the format `Display Name <email@address.com>`.
|
||||||
|
Defaults to the GitHub Actions bot user if an identity is not found in git config.
|
||||||
author:
|
author:
|
||||||
description: 'The author name and email address.'
|
description: >
|
||||||
title:
|
The author name and email address in the format `Display Name <email@address.com>`.
|
||||||
description: 'The title of the pull request.'
|
Defaults to the GitHub Actions bot user if an identity is not found in git config.
|
||||||
body:
|
|
||||||
description: 'The body of the pull request.'
|
|
||||||
labels:
|
|
||||||
description: 'A comma separated list of labels.'
|
|
||||||
assignees:
|
|
||||||
description: 'A comma separated list of assignees (GitHub usernames).'
|
|
||||||
reviewers:
|
|
||||||
description: 'A comma separated list of reviewers (GitHub usernames) to request a review from.'
|
|
||||||
team-reviewers:
|
|
||||||
description: 'A comma separated list of GitHub teams to request a review from.'
|
|
||||||
milestone:
|
|
||||||
description: 'The number of the milestone to associate this pull request with.'
|
|
||||||
project:
|
|
||||||
description: 'Deprecated. See README for details.'
|
|
||||||
project-column:
|
|
||||||
description: 'Deprecated. See README for details.'
|
|
||||||
draft:
|
|
||||||
description: 'Create a draft pull request'
|
|
||||||
branch:
|
branch:
|
||||||
description: 'The pull request branch name.'
|
description: 'The pull request branch name.'
|
||||||
push-to-fork:
|
default: 'create-pull-request/patch'
|
||||||
description: 'A fork of the checked out base repository to which the pull request branch will be pushed.'
|
|
||||||
base:
|
base:
|
||||||
description: 'The pull request base branch.'
|
description: >
|
||||||
|
The pull request base branch.
|
||||||
|
Defaults to the branch checked out in the workflow.
|
||||||
|
push-to-fork:
|
||||||
|
description: >
|
||||||
|
A fork of the checked out parent repository to which the pull request branch will be pushed.
|
||||||
|
e.g. 'owner/repo-fork'
|
||||||
|
The pull request will be created to merge the fork's branch into the parent's base.
|
||||||
|
title:
|
||||||
|
description: 'The title of the pull request.'
|
||||||
|
default: 'Changes by create-pull-request action'
|
||||||
|
body:
|
||||||
|
description: 'The body of the pull request.'
|
||||||
|
default: 'Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action'
|
||||||
|
labels:
|
||||||
|
description: 'A comma or newline separated list of labels.'
|
||||||
|
assignees:
|
||||||
|
description: 'A comma or newline separated list of assignees (GitHub usernames).'
|
||||||
|
reviewers:
|
||||||
|
description: 'A comma or newline separated list of reviewers (GitHub usernames) to request a review from.'
|
||||||
|
team-reviewers:
|
||||||
|
description: 'A comma or newline separated list of GitHub teams to request a review from.'
|
||||||
|
milestone:
|
||||||
|
description: 'The number of the milestone to associate the pull request with.'
|
||||||
|
draft:
|
||||||
|
description: 'Create a draft pull request'
|
||||||
|
default: false
|
||||||
outputs:
|
outputs:
|
||||||
pull-request-number:
|
pull-request-number:
|
||||||
description: 'The pull request number'
|
description: 'The pull request number'
|
||||||
|
|
19
dist/index.js
vendored
19
dist/index.js
vendored
|
@ -1296,6 +1296,9 @@ function run() {
|
||||||
commitMessage: core.getInput('commit-message'),
|
commitMessage: core.getInput('commit-message'),
|
||||||
committer: core.getInput('committer'),
|
committer: core.getInput('committer'),
|
||||||
author: core.getInput('author'),
|
author: core.getInput('author'),
|
||||||
|
branch: core.getInput('branch'),
|
||||||
|
base: core.getInput('base'),
|
||||||
|
pushToFork: core.getInput('push-to-fork'),
|
||||||
title: core.getInput('title'),
|
title: core.getInput('title'),
|
||||||
body: core.getInput('body'),
|
body: core.getInput('body'),
|
||||||
labels: utils.getInputAsArray('labels'),
|
labels: utils.getInputAsArray('labels'),
|
||||||
|
@ -1303,10 +1306,7 @@ function run() {
|
||||||
reviewers: utils.getInputAsArray('reviewers'),
|
reviewers: utils.getInputAsArray('reviewers'),
|
||||||
teamReviewers: utils.getInputAsArray('team-reviewers'),
|
teamReviewers: utils.getInputAsArray('team-reviewers'),
|
||||||
milestone: Number(core.getInput('milestone')),
|
milestone: Number(core.getInput('milestone')),
|
||||||
draft: core.getInput('draft') === 'true',
|
draft: core.getInput('draft') === 'true'
|
||||||
branch: core.getInput('branch'),
|
|
||||||
pushToFork: core.getInput('push-to-fork'),
|
|
||||||
base: core.getInput('base')
|
|
||||||
};
|
};
|
||||||
core.debug(`Inputs: ${util_1.inspect(inputs)}`);
|
core.debug(`Inputs: ${util_1.inspect(inputs)}`);
|
||||||
yield create_pull_request_1.createPullRequest(inputs);
|
yield create_pull_request_1.createPullRequest(inputs);
|
||||||
|
@ -10592,10 +10592,6 @@ const git_command_manager_1 = __webpack_require__(289);
|
||||||
const git_auth_helper_1 = __webpack_require__(287);
|
const git_auth_helper_1 = __webpack_require__(287);
|
||||||
const git_identity_helper_1 = __webpack_require__(723);
|
const git_identity_helper_1 = __webpack_require__(723);
|
||||||
const utils = __importStar(__webpack_require__(611));
|
const utils = __importStar(__webpack_require__(611));
|
||||||
const DEFAULT_COMMIT_MESSAGE = '[create-pull-request] automated change';
|
|
||||||
const DEFAULT_TITLE = 'Changes by create-pull-request action';
|
|
||||||
const DEFAULT_BODY = 'Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action';
|
|
||||||
const DEFAULT_BRANCH = 'create-pull-request/patch';
|
|
||||||
function createPullRequest(inputs) {
|
function createPullRequest(inputs) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let gitAuthHelper;
|
let gitAuthHelper;
|
||||||
|
@ -10609,13 +10605,6 @@ function createPullRequest(inputs) {
|
||||||
gitAuthHelper = new git_auth_helper_1.GitAuthHelper(git);
|
gitAuthHelper = new git_auth_helper_1.GitAuthHelper(git);
|
||||||
yield gitAuthHelper.savePersistedAuth();
|
yield gitAuthHelper.savePersistedAuth();
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
// Set defaults
|
|
||||||
inputs.commitMessage = inputs.commitMessage
|
|
||||||
? inputs.commitMessage
|
|
||||||
: DEFAULT_COMMIT_MESSAGE;
|
|
||||||
inputs.title = inputs.title ? inputs.title : DEFAULT_TITLE;
|
|
||||||
inputs.body = inputs.body ? inputs.body : DEFAULT_BODY;
|
|
||||||
inputs.branch = inputs.branch ? inputs.branch : DEFAULT_BRANCH;
|
|
||||||
// Init the GitHub client
|
// Init the GitHub client
|
||||||
const githubHelper = new github_helper_1.GitHubHelper(inputs.token);
|
const githubHelper = new github_helper_1.GitHubHelper(inputs.token);
|
||||||
core.startGroup('Determining the base and head repositories');
|
core.startGroup('Determining the base and head repositories');
|
||||||
|
|
|
@ -6,18 +6,15 @@ import {GitAuthHelper} from './git-auth-helper'
|
||||||
import {GitIdentityHelper} from './git-identity-helper'
|
import {GitIdentityHelper} from './git-identity-helper'
|
||||||
import * as utils from './utils'
|
import * as utils from './utils'
|
||||||
|
|
||||||
const DEFAULT_COMMIT_MESSAGE = '[create-pull-request] automated change'
|
|
||||||
const DEFAULT_TITLE = 'Changes by create-pull-request action'
|
|
||||||
const DEFAULT_BODY =
|
|
||||||
'Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action'
|
|
||||||
const DEFAULT_BRANCH = 'create-pull-request/patch'
|
|
||||||
|
|
||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
token: string
|
token: string
|
||||||
path: string
|
path: string
|
||||||
commitMessage: string
|
commitMessage: string
|
||||||
committer: string
|
committer: string
|
||||||
author: string
|
author: string
|
||||||
|
branch: string
|
||||||
|
base: string
|
||||||
|
pushToFork: string
|
||||||
title: string
|
title: string
|
||||||
body: string
|
body: string
|
||||||
labels: string[]
|
labels: string[]
|
||||||
|
@ -26,9 +23,6 @@ export interface Inputs {
|
||||||
teamReviewers: string[]
|
teamReviewers: string[]
|
||||||
milestone: number
|
milestone: number
|
||||||
draft: boolean
|
draft: boolean
|
||||||
branch: string
|
|
||||||
pushToFork: string
|
|
||||||
base: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createPullRequest(inputs: Inputs): Promise<void> {
|
export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||||
|
@ -45,14 +39,6 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||||
await gitAuthHelper.savePersistedAuth()
|
await gitAuthHelper.savePersistedAuth()
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// Set defaults
|
|
||||||
inputs.commitMessage = inputs.commitMessage
|
|
||||||
? inputs.commitMessage
|
|
||||||
: DEFAULT_COMMIT_MESSAGE
|
|
||||||
inputs.title = inputs.title ? inputs.title : DEFAULT_TITLE
|
|
||||||
inputs.body = inputs.body ? inputs.body : DEFAULT_BODY
|
|
||||||
inputs.branch = inputs.branch ? inputs.branch : DEFAULT_BRANCH
|
|
||||||
|
|
||||||
// Init the GitHub client
|
// Init the GitHub client
|
||||||
const githubHelper = new GitHubHelper(inputs.token)
|
const githubHelper = new GitHubHelper(inputs.token)
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ async function run(): Promise<void> {
|
||||||
commitMessage: core.getInput('commit-message'),
|
commitMessage: core.getInput('commit-message'),
|
||||||
committer: core.getInput('committer'),
|
committer: core.getInput('committer'),
|
||||||
author: core.getInput('author'),
|
author: core.getInput('author'),
|
||||||
|
branch: core.getInput('branch'),
|
||||||
|
base: core.getInput('base'),
|
||||||
|
pushToFork: core.getInput('push-to-fork'),
|
||||||
title: core.getInput('title'),
|
title: core.getInput('title'),
|
||||||
body: core.getInput('body'),
|
body: core.getInput('body'),
|
||||||
labels: utils.getInputAsArray('labels'),
|
labels: utils.getInputAsArray('labels'),
|
||||||
|
@ -18,10 +21,7 @@ async function run(): Promise<void> {
|
||||||
reviewers: utils.getInputAsArray('reviewers'),
|
reviewers: utils.getInputAsArray('reviewers'),
|
||||||
teamReviewers: utils.getInputAsArray('team-reviewers'),
|
teamReviewers: utils.getInputAsArray('team-reviewers'),
|
||||||
milestone: Number(core.getInput('milestone')),
|
milestone: Number(core.getInput('milestone')),
|
||||||
draft: core.getInput('draft') === 'true',
|
draft: core.getInput('draft') === 'true'
|
||||||
branch: core.getInput('branch'),
|
|
||||||
pushToFork: core.getInput('push-to-fork'),
|
|
||||||
base: core.getInput('base')
|
|
||||||
}
|
}
|
||||||
core.debug(`Inputs: ${inspect(inputs)}`)
|
core.debug(`Inputs: ${inspect(inputs)}`)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue