File tree 3 files changed +17
-4
lines changed
3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 76
76
| `git_name` | Name used to configure git (for git operations) | `github-actions[bot]` |
77
77
| `git_email` | Email address used to configure git (for git operations) | `github-actions[bot]@users.noreply.github.com` |
78
78
| `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
+
79
81
| `commit` | Define if the changes should be committed to the branch. | true |
80
82
| `commitizen_version` | Specify the version to be used by commitizen. Eg : ` 2.21.0` | latest |
81
83
| `changelog` | Create changelog when bumping the version | true |
Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ inputs:
21
21
description : ' If true the bump commit is pushed to the remote repository'
22
22
required : false
23
23
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"
24
30
prerelease :
25
31
description : ' Set as prerelease version'
26
32
required : false
Original file line number Diff line number Diff line change @@ -72,10 +72,15 @@ echo "Repository: ${INPUT_REPOSITORY}"
72
72
echo " Actor: ${GITHUB_ACTOR} "
73
73
74
74
if [[ $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
79
84
else
80
85
echo " Not pushing"
81
86
fi
You can’t perform that action at this time.
0 commit comments