Skip to content

Commit

Permalink
✨ Add PR_BODY option (#80)
Browse files Browse the repository at this point in the history
This commit adds a PR body input to the action, that can be used to add additional text to the PR description. This is useful when trying the explain more about the PR such as the cause behind its creation and how the future changes will lead to a forced push instead of a new PR.

Originally discussed in #78.

* Add a PR body input for the action

* Add the `PR_BODY` variable to the context

* Use `PR_BODY` in the PR body

* Replace array with string

* Move the PR body aboved the changed files
  • Loading branch information
dhruvkb authored Aug 11, 2021
1 parent 34f934e commit d910669
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
description: |
Labels which will be added to the pull request. Defaults to sync. Set to false to turn off
required: false
PR_BODY:
description: |
Additional content to add in the PR description. Defaults to ''
required: false
ASSIGNEES:
description: |
People to assign to the pull request. Defaults to none
Expand Down
6 changes: 5 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ try {
type: 'array',
disableable: true
}),
PR_BODY: getInput({
key: 'PR_BODY',
default: ''
}),
ASSIGNEES: getInput({
key: 'ASSIGNEES',
type: 'array'
Expand Down Expand Up @@ -209,4 +213,4 @@ const parseConfig = async () => {
module.exports = {
...context,
parseConfig
}
}
5 changes: 4 additions & 1 deletion src/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const {
COMMIT_PREFIX,
GITHUB_REPOSITORY,
OVERWRITE_EXISTING_PR,
PR_BODY,
BRANCH_PREFIX
} = require('./config')

Expand Down Expand Up @@ -194,6 +195,8 @@ class Git {
const body = dedent(`
Synced local file(s) with [${ GITHUB_REPOSITORY }](https://github.com/${ GITHUB_REPOSITORY }).
${ PR_BODY }
${ changedFiles }
---
Expand Down Expand Up @@ -249,4 +252,4 @@ class Git {
}
}

module.exports = Git
module.exports = Git

0 comments on commit d910669

Please sign in to comment.