Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ inputs:
required: false
body:
description: >
Override the default generated PR body, the special string `{old_pull_request_id}` will be substituted
for the ID of the pull request which triggered the action
Override the default generated PR body. The special string `{old_pull_request_id}` will be substituted
for the ID of the pull request which triggered the action, and `{old_body}` will be substituted
for the body of the pull request which triggered the action.
required: false
labels:
description: "A comma or newline separated list of labels."
Expand Down
12 changes: 11 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/github-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export async function createPullRequest(
'{old_pull_request_id}',
pull_request.number.toString()
)
// replace {old_body} with the original PR body so callers can prepend
// or append text while still including the original description
body = body.replace('{old_body}', pull_request.body ?? '')
}
core.info(`Using body '${body}'`)

Expand Down
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ export async function run(): Promise<void> {
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODOs:

  • undo dist/index.js after testing
  • merge PR, and cut a new tag & publish new release
  • ensure dist/index.js gets updated

// Take whatever is suggested by git if there are conflicts
await gitExecution(['add', '.'])
await gitExecution(['commit'])

// only commit if there are changes
const status = await gitExecution(['status', '--porcelain'])
if (status.stdout.trim().length === 0) {
core.info('Working tree clean; skipping commit.')
} else {
await gitExecution(['commit', '--no-edit'])
Comment thread
rpunia1 marked this conversation as resolved.
}

core.endGroup()

// Push new branch
Expand Down