Skip to content

Commit 45a869c

Browse files
authored
Update action.yml
1 parent a02532f commit 45a869c

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

action.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,30 @@
11
name: 'diff-pr-management'
22
description: '差分があればPRを作り、差分がなければPRを閉じます'
33
inputs:
4-
who-to-greet: # id of input
5-
description: 'Who to greet'
4+
github-token: # id of input
5+
description: 'GITHUB_TOKEN'
66
required: true
7-
default: 'World'
87
outputs:
98
random-number:
109
description: "Random number"
1110
value: ${{ steps.random-number-generator.outputs.random-id }}
1211
runs:
1312
using: "composite"
1413
steps:
15-
# 差分があったときは差分を出力する
16-
- name: Show diff
17-
id: show_diff
18-
run: |
19-
echo "::set-output name=diff::$(git diff)"
2014
# 差分があったときは、コミットを作りpushする
2115
- name: Push
22-
if: steps.show_diff.outputs.diff != ''
2316
run: |
2417
git config user.name "hatohakaraage"
2518
git config user.email "hatohakaraage@example.com"
2619
git add -u
2720
git commit -m "鳩は唐揚げ!(自動で直してあげたよ!)"
28-
git push -f https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:refs/heads/fix-text-${{github.event.pull_request.head.ref}}
21+
git push -f https://${{github.actor}}:${{inputs.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:refs/heads/fix-text-${{github.event.pull_request.head.ref}}
22+
shell: bash
2923
# pushしたブランチでPRを作る
3024
- name: Create PullRequest
3125
uses: actions/github-script@v3
32-
if: steps.show_diff.outputs.diff != ''
3326
with:
34-
github-token: ${{secrets.GITHUB_TOKEN}}
27+
github-token: ${{inputs.GITHUB_TOKEN}}
3528
script: |
3629
const common_params = {
3730
owner: context.repo.owner,
@@ -71,12 +64,12 @@ runs:
7164
})
7265
}
7366
})
67+
shell: bash
7468
# 既にformat修正のPRがある状態で、手動でformatを修正した場合、format修正のPRを閉じる
7569
- name: Close PullRequest
7670
uses: actions/github-script@v3
77-
if: steps.show_diff.outputs.diff == ''
7871
with:
79-
github-token: ${{secrets.GITHUB_TOKEN}}
72+
github-token: ${{inputs.GITHUB_TOKEN}}
8073
script: |
8174
const head_name = "fix-text-${{github.event.pull_request.head.ref}}"
8275
const common_params = {
@@ -111,6 +104,7 @@ runs:
111104
})
112105
}
113106
})
107+
shell: bash
114108
- name: Exit
115-
if: steps.show_diff.outputs.diff != ''
116109
run: exit 1
110+
shell: bash

0 commit comments

Comments
 (0)