MCPcopy Index your code
hub / github.com/peter-evans/create-pull-request / run

Function run

src/main.ts:14–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12}
13
14async function run(): Promise<void> {
15 try {
16 const inputs: Inputs = {
17 token: core.getInput('token'),
18 branchToken: core.getInput('branch-token'),
19 path: core.getInput('path'),
20 addPaths: utils.getInputAsArray('add-paths'),
21 commitMessage: core.getInput('commit-message'),
22 committer: core.getInput('committer'),
23 author: core.getInput('author'),
24 signoff: core.getBooleanInput('signoff'),
25 branch: core.getInput('branch'),
26 deleteBranch: core.getBooleanInput('delete-branch'),
27 branchSuffix: core.getInput('branch-suffix'),
28 base: core.getInput('base'),
29 pushToFork: core.getInput('push-to-fork'),
30 signCommits: core.getBooleanInput('sign-commits'),
31 title: core.getInput('title'),
32 body: core.getInput('body'),
33 bodyPath: core.getInput('body-path'),
34 labels: utils.getInputAsArray('labels'),
35 assignees: utils.getInputAsArray('assignees'),
36 reviewers: utils.getInputAsArray('reviewers'),
37 teamReviewers: utils.getInputAsArray('team-reviewers'),
38 milestone: Number(core.getInput('milestone')),
39 draft: getDraftInput(),
40 maintainerCanModify: core.getBooleanInput('maintainer-can-modify')
41 }
42 core.debug(`Inputs: ${inspect(inputs)}`)
43
44 if (!inputs.token) {
45 throw new Error(`Input 'token' not supplied. Unable to continue.`)
46 }
47 if (!inputs.branchToken) {
48 inputs.branchToken = inputs.token
49 }
50 if (inputs.bodyPath) {
51 if (!utils.fileExistsSync(inputs.bodyPath)) {
52 throw new Error(`File '${inputs.bodyPath}' does not exist.`)
53 }
54 // Update the body input with the contents of the file
55 inputs.body = utils.readFile(inputs.bodyPath)
56 }
57 // 65536 characters is the maximum allowed for the pull request body.
58 if (inputs.body.length > 65536) {
59 core.warning(
60 `Pull request body is too long. Truncating to 65536 characters.`
61 )
62 inputs.body = inputs.body.substring(0, 65536)
63 }
64
65 await createPullRequest(inputs)
66 } catch (error) {
67 core.setFailed(utils.getErrorMessage(error))
68 }
69}
70
71run()

Callers 1

main.tsFile · 0.85

Calls 2

createPullRequestFunction · 0.90
getDraftInputFunction · 0.85

Tested by

no test coverage detected