File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 7676| `git_name` | Name used to configure git (for git operations) | `github-actions[bot]` |
7777| `git_email` | Email address used to configure git (for git operations) | `github-actions[bot]@users.noreply.github.com` |
7878| `push` | Define if the changes should be pushed to the branch. | true |
79+ | `merge` | Define if the changes should be pushed even on the pull_request event, immediately merging the pull request. | false |
80+
7981| `commit` | Define if the changes should be committed to the branch. | true |
8082| `commitizen_version` | Specify the version to be used by commitizen. Eg : ` 2.21.0` | latest |
8183| `changelog` | Create changelog when bumping the version | true |
Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ inputs:
2121 description : ' If true the bump commit is pushed to the remote repository'
2222 required : false
2323 default : " true"
24+ merge :
25+ description : >
26+ If true, the bump commit is pushed to the remote repository even when the
27+ action is run on the pull_request event, immediately merging the pull request
28+ required : false
29+ default : " false"
2430 prerelease :
2531 description : ' Set as prerelease version'
2632 required : false
Original file line number Diff line number Diff line change @@ -72,10 +72,15 @@ echo "Repository: ${INPUT_REPOSITORY}"
7272echo " Actor: ${GITHUB_ACTOR} "
7373
7474if [[ $INPUT_PUSH == ' true' ]]; then
75- echo " Pushing to branch..."
76- REMOTE_REPO=" https://${GITHUB_ACTOR} :${INPUT_GITHUB_TOKEN} @github.com/${INPUT_REPOSITORY} .git"
77- git pull " $REMOTE_REPO " " $INPUT_BRANCH "
78- git push " $REMOTE_REPO " " HEAD:${INPUT_BRANCH} " --tags
75+ if [[ $INPUT_MERGE != ' true' && $GITHUB_EVENT_NAME == ' pull_request' ]]; then
76+ echo " Refusing to push on pull_request event since that would merge the pull request." >&2
77+ echo " You probably want to run on push to your default branch instead." >&2
78+ else
79+ echo " Pushing to branch..."
80+ REMOTE_REPO=" https://${GITHUB_ACTOR} :${INPUT_GITHUB_TOKEN} @github.com/${INPUT_REPOSITORY} .git"
81+ git pull " $REMOTE_REPO " " $INPUT_BRANCH "
82+ git push " $REMOTE_REPO " " HEAD:${INPUT_BRANCH} " --tags
83+ fi
7984else
8085 echo " Not pushing"
8186fi
You can’t perform that action at this time.
0 commit comments