Skip to content

Commit 6edc7ed

Browse files
authored
Merge pull request #17 from commitizen-tools/feat/detect-branch
feat: detect default branch
2 parents 546dceb + b60cd40 commit 6edc7ed

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,26 @@ jobs:
6464
6565
## Variables
6666
67-
| Name | Description | Default |
68-
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------- |
69-
| `github_token` | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}` **required** | - |
70-
| `dry_run` | Run without creating commit, output to stdout | false |
71-
| `repository` | Repository name to push. Default or empty value represents current github repository | current one |
72-
| `branch` | Destination branch to push changes | `master` |
73-
| `prerelease` | Set as prerelease {alpha,beta,rc} choose type of prerelease | - |
74-
| `extra_requirements` | Custom requirements, if your project uses a custom rule or plugins, you can specify them separated by a space. E.g: `'commitizen-emoji conventional-JIRA'` | - |
75-
| `changelog_increment_filename` | Filename to store the incremented generated changelog. This is different to changelog as it only contains the changes for the just generated version. Example: `body.md` | - |
76-
| `git_name` | Name used to configure git (for git operations) | `github-actions[bot]` |
77-
| `git_email` | Email address used to configure git (for git operations) | `github-actions[bot]@users.noreply.github.com` |
78-
| `push` | Define if the changes should be pushed to the branch. | true |
79-
| `commit` | Define if the changes should be committed to the branch. | true |
80-
<!-- | `changelog` | Create changelog when bumping the version | true | -->
67+
| Name | Description | Default |
68+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
69+
| `github_token` | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}` **required** | - |
70+
| `dry_run` | Run without creating commit, output to stdout | false |
71+
| `repository` | Repository name to push. Default or empty value represents current github repository | current one |
72+
| `branch` | Destination branch to push changes | Same as the one executing the action by default |
73+
| `prerelease` | Set as prerelease {alpha,beta,rc} choose type of prerelease | - |
74+
| `extra_requirements` | Custom requirements, if your project uses a custom rule or plugins, you can specify them separated by a space. E.g: `'commitizen-emoji conventional-JIRA'` | - |
75+
| `changelog_increment_filename` | Filename to store the incremented generated changelog. This is different to changelog as it only contains the changes for the just generated version. Example: `body.md` | - |
76+
| `git_name` | Name used to configure git (for git operations) | `github-actions[bot]` |
77+
| `git_email` | Email address used to configure git (for git operations) | `github-actions[bot]@users.noreply.github.com` |
78+
| `push` | Define if the changes should be pushed to the branch. | true |
79+
| `commit` | Define if the changes should be committed to the branch. | true |
80+
| <!-- | `changelog` | Create changelog when bumping the version | true | --> |
8181

8282
## Outputs
8383

84-
| Name | Description |
85-
| --------- | -------------------- |
86-
| `version` | The new version |
84+
| Name | Description |
85+
| --------- | --------------- |
86+
| `version` | The new version |
8787

8888
Additionally, the new version is also availble as an environment variable under `REVISION`.
8989

entrypoint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ if [ $INPUT_DRY_RUN ]; then INPUT_DRY_RUN='--dry-run'; else INPUT_DRY_RUN=''; fi
44
if [ $INPUT_CHANGELOG ]; then INPUT_CHANGELOG='--changelog'; else INPUT_CHANGELOG=''; fi
55
if [ $INPUT_PRERELEASE ]; then INPUT_PRERELEASE="--prerelease $INPUT_PRERELEASE"; else INPUT_PRERELEASE=''; fi
66
if [ "$INPUT_COMMIT" == 'false' ]; then INPUT_COMMIT='--files-only'; else INPUT_COMMIT=''; fi
7-
INPUT_BRANCH=${INPUT_BRANCH:-master}
7+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
8+
INPUT_BRANCH=${INPUT_BRANCH:-$CURRENT_BRANCH}
89
INPUT_EXTRA_REQUIREMENTS=${INPUT_EXTRA_REQUIREMENTS:-''}
910
REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
1011
# : "${INPUT_CHANGELOG:=true}" ignroed for now, let's check that it works

0 commit comments

Comments
 (0)