File tree Expand file tree Collapse file tree 2 files changed +128
-0
lines changed
Expand file tree Collapse file tree 2 files changed +128
-0
lines changed Original file line number Diff line number Diff line change 1+ # bump-request
2+
3+ [ Custom action] ( https://docs.github.com/en//actions/creating-actions/about-custom-actions ) to create a pull request that bumps version.
4+
5+ ## Usage
6+
7+ Create a workflow file as follows:
8+
9+ ``` yaml
10+ # .github/workflows/bump-request.yml
11+ name : bump-request
12+
13+ on :
14+ workflow_dispatch :
15+ inputs :
16+ version :
17+ description : Version to change to.
18+ required : true
19+ type : string
20+
21+ jobs :
22+ run :
23+ runs-on : ubuntu-latest
24+ steps :
25+ - uses : r7kamura/bump-request@v0
26+ with :
27+ command : |
28+ npm version --no-git-commit-hooks --no-git-tag-version "${{ inputs.version }}"
29+ version : ${{ inputs.version }}
30+ ` ` `
31+
32+ Now you can run it manually via actions page:
33+
34+ 
35+
36+ or if you want to do it from CLI, use [GitHub CLI](https://cli.github.com/) like this:
37+
38+ ` ` ` bash
39+ gh workflow run bump-request --field version=1.2.3
40+ ```
41+
42+ After the action is complete, a new pull request is created.
43+
44+ ## Inputs
45+
46+ ### ` command `
47+
48+ Shell command for modifying files that contain versions such as package.json, Catgo.toml, etc.
49+
50+ - required
51+
52+ NPM package example:
53+
54+ ``` yaml
55+ command : |
56+ npm version --no-git-commit-hooks --no-git-tag-version "${{ inputs.version }}"
57+ ` ` `
58+
59+ Ruby gem example:
60+
61+ ` ` ` yaml
62+ command : |
63+ sed -i -r 's/([0-9]+\.[0-9]+\.[0-9]+)/${{ inputs.version }}/' lib/my_ruby_gem/version.rb
64+ bundle install
65+ ` ` `
66+
67+ ### ` version`
68+
69+ Version to change to.
70+
71+ - required
72+ - e.g. `1.2.3`
73+
74+ # ## `gh_pr_create_options`
75+
76+ Additional options for `gh pr create` command.
77+
78+ - optional
79+ - e.g. `--draft`
Original file line number Diff line number Diff line change 1+ name : bump-request
2+ description : Create a pull request that bumps version.
3+ inputs :
4+ command :
5+ descriotion : Shell command for modifying files that contain versions such as package.json, Catgo.toml, etc.
6+ required : true
7+ gh_pr_create_options :
8+ desecription : Additional options for `gh pr create` command.
9+ required : false
10+ default : " "
11+ github_token :
12+ description : GitHub access token.
13+ required : false
14+ version :
15+ description : Version to change to.
16+ required : true
17+ runs :
18+ using : composite
19+ steps :
20+ - uses : actions/checkout@v3
21+ - name : Run command
22+ run : |
23+ ${{ inputs.command }}
24+ shell : bash
25+ - name : Create pull request
26+ run : |
27+ description=$(
28+ gh api \
29+ --method POST \
30+ -H "Accept: application/vnd.github+json" \
31+ -f tag_name='v${{ inputs.version }}' \
32+ -f target_commitish='${{ github.ref }}' \
33+ --jq '.name + "\n\n" + .body' \
34+ /repos/${{ github.repository }}/releases/generate-notes
35+ )
36+ branch="bump-request-${GITHUB_RUN_ID}"
37+ git config user.name "${GITHUB_ACTOR}"
38+ git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
39+ git switch --create "${branch}"
40+ git add .
41+ git commit --message "${description}"
42+ git push --set-upstream origin "${branch}"
43+ gh pr create --fill ${{ inputs.gh_pr_create_options }}
44+ env :
45+ GITHUB_TOKEN : ${{ inputs.github_token || github.token }}
46+ shell : bash
47+ branding :
48+ color : blue
49+ icon : git-pull-request
You can’t perform that action at this time.
0 commit comments