Skip to content

Commit 7cc8ab1

Browse files
authored
処理内容を説明するコメント追加 (#1687)
* 処理内容を説明するコメント追加 * format修正のPR -> 修正PR
1 parent 73e6a8b commit 7cc8ab1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ runs:
6464
script: |
6565
const script = require('${{ github.action_path }}/scripts/action/get_pull_requests.js')
6666
return await script({github, context})
67-
# pushしたブランチでPRを作る
67+
# pushしたブランチで修正PRを作る
6868
- name: Create PullRequest
6969
uses: actions/[email protected]
7070
if: steps.diff.outputs.result != '' && steps.get_pull_requests.outputs.result == 0 && ((github.event_name == 'pull_request' && github.event.action != 'closed') || github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch')
@@ -79,6 +79,7 @@ runs:
7979
script: |
8080
const script = require('${{ github.action_path }}/scripts/action/create_pull_request.js')
8181
return await script({github, context})
82+
# 元のPRを出したユーザーを修正PRにアサインする
8283
- name: Assign a user
8384
uses: actions/[email protected]
8485
if: steps.diff.outputs.result != '' && steps.get_pull_requests.outputs.result == 0 && github.event_name == 'pull_request' && github.event.action != 'closed' && github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.user.login != 'renovate[bot]'
@@ -89,7 +90,7 @@ runs:
8990
script: |
9091
const script = require('${{ github.action_path }}/scripts/action/assign_a_user.js')
9192
await script({github, context})
92-
# 既にformat修正のPRがある状態で、手動でformatを修正した場合、format修正のPRを閉じる
93+
# 既に修正PRがある状態で、手動でformatを修正した場合、修正PRを閉じる
9394
- name: Close PullRequest
9495
uses: actions/[email protected]
9596
if: (github.event_name == 'pull_request' && (github.event.action == 'closed' || steps.diff.outputs.result == '')) || ((github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch') && steps.diff.outputs.result == '')
@@ -100,6 +101,7 @@ runs:
100101
script: |
101102
const script = require('${{ github.action_path }}/scripts/action/close_pull_request.js')
102103
await script({github, context})
104+
# exit-failureがtrueで差分がある場合は異常終了する
103105
- name: Exit
104106
if: (github.event_name != 'pull_request' || github.event.action != 'closed') && steps.diff.outputs.result != '' && inputs.exit-failure == 'true'
105107
run: exit 1

scripts/action/close_pull_request.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module.exports = async ({ github, context }) => {
1010
owner: context.repo.owner,
1111
repo: context.repo.repo,
1212
};
13+
14+
// 修正PRの情報を取得する
1315
const pullsListParams = {
1416
head: context.repo.owner + ":" + headName,
1517
state: "open",
@@ -19,13 +21,16 @@ module.exports = async ({ github, context }) => {
1921
const pulls = await github.paginate(github.rest.pulls.list, pullsListParams);
2022

2123
for (const pull of pulls) {
24+
// 修正PRをcloseする (修正PRのstateをclosedに更新する)
2225
const pullsUpdateParams = {
2326
pull_number: pull.number,
2427
state: "closed",
2528
...commonParams,
2629
};
2730
console.log("call pulls.update:", pullsUpdateParams);
2831
await github.rest.pulls.update(pullsUpdateParams);
32+
33+
// 修正PRのブランチを削除する
2934
const gitDeleteRefParams = {
3035
ref: "heads/" + headName,
3136
...commonParams,

0 commit comments

Comments
 (0)