File tree Expand file tree Collapse file tree 4 files changed +43
-23
lines changed
Expand file tree Collapse file tree 4 files changed +43
-23
lines changed Original file line number Diff line number Diff line change 1212 steps :
1313 - name : Check out
1414 uses : actions/checkout@v2
15+ with :
16+ fetch-depth : 0
1517 - name : Create bump and changelog
1618 uses : Woile/commitizen-action@master
17- with :
18- dry_run : false
19- - name : Push changes back to master
20- uses : ad-m/github-push-action@master
2119 with :
2220 github_token : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 2020jobs :
2121 bump_version :
2222 runs-on : ubuntu-latest
23- name : ' Bump version and create changelog with commitizen'
23+ name : " Bump version and create changelog with commitizen"
2424 steps :
25- - name : Check out
26- uses : actions/checkout@v2
27- - name : Create bump and changelog
28- uses : Woile/commitizen-action@master
29- with :
30- dry_run : false
31- - name : Push changes back to master
32- uses : ad-m/github-push-action@master
33- with :
34- github_token : ${{ secrets.GITHUB_TOKEN }}
35-
25+ - name : Check out
26+ uses : actions/checkout@v2
27+ with :
28+ fetch-depth : 0
29+ - name : Create bump and changelog
30+ uses : Woile/commitizen-action@master
31+ with :
32+ github_token : ${{ secrets.GITHUB_TOKEN }}
3633` ` `
3734
3835## Variables
3936
40- | Name | Description | Default |
41- | ----------- | --------------------------------------------- | ------- |
42- | ` dry_run ` | Run without creating commit, output to stdout | false |
43- | ` changelog ` | Create changelog when bumping the version | true |
37+ | Name | Description | Default |
38+ | -------------- | ------------------------------------------------------------------------------------------------------------ | ----------- |
39+ | ` github_token` | Token for the repo. Can be passed in using \$\{{ secrets.GITHUB_TOKEN }} **required** | - |
40+ | `dry_run` | Run without creating commit, output to stdout | false |
41+ | `repository` | Repository name to push. Default or empty value represents current github repository (\${GITHUB_REPOSITORY}) | current one |
42+ | `branch` | Destination branch to push changes | `master` |
43+
44+ <!-- | `changelog` | Create changelog when bumping the version | true | -->
4445
4546# # Contributing
4647
Original file line number Diff line number Diff line change @@ -14,4 +14,15 @@ inputs:
1414 changelog :
1515 description : ' Create changelog when bumping the version'
1616 default : " true"
17- required : false
17+ required : false
18+ github_token :
19+ description : ' Token for the repo. Can be passed in using $\{{ secrets.GITHUB_TOKEN }}'
20+ required : true
21+ repository :
22+ description : ' Repository name to push. Default or empty value represents current github repository (${GITHUB_REPOSITORY})'
23+ default : ' '
24+ required : false
25+ branch :
26+ description : ' Destination branch to push changes'
27+ required : false
28+ default : ' master'
Original file line number Diff line number Diff line change 11#! /bin/bash
22
33: " ${INPUT_DRY_RUN:= false} "
4+ INPUT_BRANCH=${INPUT_BRANCH:- master}
5+ REPOSITORY=${INPUT_REPOSITORY:- $GITHUB_REPOSITORY }
46# : "${INPUT_CHANGELOG:=true}" ignroed for now, let's check that it works
57
68set -e
79
8- echo " Repository: $GITHUB_REPOSITORY "
10+ [ -z " ${INPUT_GITHUB_TOKEN} " ] && {
11+ echo ' Missing input "github_token: ${{ secrets.GITHUB_TOKEN }}".' ;
12+ exit 1;
13+ };
14+
15+ echo " Repository: $REPOSITORY "
916echo " Actor: $GITHUB_ACTOR "
1017
1118echo " Installing requirements..."
12-
1319if [[ -f " requirements.txt" ]]; then
1420 # Ensure commitizen + reqs may have custom commitizen plugins
1521 pip install -r requirements.txt commitizen
2834 cz bump --yes --changelog --dry-run
2935fi
3036
37+ echo " Pushing to branch..."
38+ remote_repo=" https://${GITHUB_ACTOR} :${INPUT_GITHUB_TOKEN} @github.com/${REPOSITORY} .git"
39+ git push " ${remote_repo} " HEAD:${INPUT_BRANCH} --follow-tags --tags;
40+
3141echo " Done."
You can’t perform that action at this time.
0 commit comments