@@ -20,6 +20,10 @@ inputs:
2020 description : ' 本文の接頭語。'
2121 required : true
2222 default : " "
23+ base-branch :
24+ description : ' ベースブランチ。 `pull_request` 以外のトリガーの場合は決め打ちで入力。'
25+ required : false
26+ default : " "
2327runs :
2428 using : " composite"
2529 steps :
3943 - name : Push
4044 env :
4145 HEAD_REF : ${{github.event.pull_request.head.ref}}
42- if : inputs.repo-name == github.repository && steps.diff.outputs.result != '' && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'schedule')
46+ if : inputs.repo-name == github.repository && steps.diff.outputs.result != '' && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' )
4347 run : |
4448 git config user.name "github-actions[bot]"
4549 EMAIL="41898282+github-actions[bot]@users.noreply.github.com"
@@ -52,13 +56,15 @@ runs:
5256
5357 if [ "${HEAD_REF}" != "" ]; then
5458 GITHUB_HEAD+="-${HEAD_REF}"
59+ elif [ "${{inputs.base-branch}}" != "" ]; then
60+ GITHUB_HEAD+="-${{inputs.base-branch}}"
5561 fi
5662
5763 git push -f "${REPO_URL}" "${GITHUB_HEAD}"
5864 shell : bash
5965 - name : Set org name
606661- if : inputs.repo-name == github.repository && (github.event_name == 'pull_request' || github.event_name == 'schedule')
67+ if : inputs.repo-name == github.repository && (github.event_name == 'pull_request' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' )
6268 id : set_org_name
6369 with :
6470 github-token : ${{inputs.github-token}}
@@ -68,12 +74,17 @@ runs:
68746975 env :
7076 HEAD_REF : ${{github.event.pull_request.head.ref}}
71- if : inputs.repo-name == github.repository && steps.diff.outputs.result != '' && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'schedule')
77+ if : inputs.repo-name == github.repository && steps.diff.outputs.result != '' && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' )
7278 id : get_pull_requests
7379 with :
7480 github-token : ${{inputs.github-token}}
7581 script : |
76- const HEAD_REF = process.env["HEAD_REF"]
82+ let HEAD_REF = process.env["HEAD_REF"]
83+
84+ if (HEAD_REF === "" && "${{inputs.base-branch}}" !== "") {
85+ HEAD_REF = "${{inputs.base-branch}}"
86+ }
87+
7788 let head = "${{steps.set_org_name.outputs.result}}:${{inputs.branch-name-prefix}}"
7889
7990 if (HEAD_REF != "") {
@@ -96,12 +107,17 @@ runs:
9610797108 env :
98109 HEAD_REF : ${{github.event.pull_request.head.ref}}
99- if : inputs.repo-name == github.repository && steps.diff.outputs.result != '' && steps.get_pull_requests.outputs.result == 0 && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'schedule')
110+ if : inputs.repo-name == github.repository && steps.diff.outputs.result != '' && steps.get_pull_requests.outputs.result == 0 && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' )
100111 id : create_pull_request
101112 with :
102113 github-token : ${{inputs.github-token}}
103114 script : |
104- const HEAD_REF = process.env["HEAD_REF"]
115+ let HEAD_REF = process.env["HEAD_REF"]
116+
117+ if (HEAD_REF === "" && "${{inputs.base-branch}}" !== "") {
118+ HEAD_REF = "${{inputs.base-branch}}"
119+ }
120+
105121 let title = "${{inputs.pr-title-prefix}}"
106122 let body = "${{inputs.pr-description-prefix}}"
107123
@@ -150,11 +166,16 @@ runs:
150166151167 env :
152168 HEAD_REF : ${{github.event.pull_request.head.ref}}
153- if : inputs.repo-name == github.repository && ((github.event_name == 'pull_request' && (github.event.action == 'closed' || steps.diff.outputs.result == '')) || (github.event_name == 'schedule' && steps.diff.outputs.result == ''))
169+ if : inputs.repo-name == github.repository && ((github.event_name == 'pull_request' && (github.event.action == 'closed' || steps.diff.outputs.result == '')) || (( github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && steps.diff.outputs.result == ''))
154170 with :
155171 github-token : ${{inputs.github-token}}
156172 script : |
157- const HEAD_REF = process.env["HEAD_REF"]
173+ let HEAD_REF = process.env["HEAD_REF"]
174+
175+ if (HEAD_REF === "" && "${{inputs.base-branch}}" !== "") {
176+ HEAD_REF = "${{inputs.base-branch}}"
177+ }
178+
158179 let head_name = "${{inputs.branch-name-prefix}}"
159180
160181 if (HEAD_REF != "") {
0 commit comments