Skip to content

Commit 094e27f

Browse files
committed
Simplify action.yml
Signed-off-by: Masaki Kimura <[email protected]>
1 parent 3c52a8d commit 094e27f

33 files changed

+116
-276
lines changed

.github/workflows/command-assign.yml

-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,3 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: mkimuram/test-gha/plugins/assign@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
issue_num: ${{ github.event.client_payload.github.payload.issue.number }}
14-
args: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
15-
actor: ${{ github.actor }}
16-
token: ${{secrets.PAT}}

.github/workflows/command-close.yml

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/close` | `/close` | Closes an issue or PR. |
21
name: close command
32
on:
43
repository_dispatch:
@@ -8,8 +7,3 @@ jobs:
87
runs-on: ubuntu-latest
98
steps:
109
- uses: mkimuram/test-gha/plugins/close@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
issue_num: ${{ github.event.client_payload.github.payload.issue.number }}
14-
pr_num: ${{ github.event.client_payload.pull_request.number }}
15-
token: ${{secrets.PAT}}

.github/workflows/command-kind.yml

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/kind` | `/kind bug` | Applies a kind label. |
21
name: kind command
32
on:
43
repository_dispatch:
@@ -8,8 +7,3 @@ jobs:
87
runs-on: ubuntu-latest
98
steps:
109
- uses: mkimuram/test-gha/plugins/kind@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
issue_num: ${{ github.event.client_payload.github.payload.issue.number }}
14-
args: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
15-
token: ${{secrets.PAT}}

.github/workflows/command-meow.yml

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/meow` | `/meow` | Add a cat image to the issue or PR. |
21
name: meow command
32
on:
43
repository_dispatch:
@@ -8,8 +7,3 @@ jobs:
87
runs-on: ubuntu-latest
98
steps:
109
- uses: mkimuram/test-gha/plugins/meow@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
issue_num: ${{ github.event.client_payload.github.payload.issue.number }}
14-
pr_num: ${{ github.event.client_payload.pull_request.number }}
15-
token: ${{secrets.PAT}}

.github/workflows/command-pony.yml

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/pony` | `/pony` | Add a pony image to the issue or PR. |
21
name: pony command
32
on:
43
repository_dispatch:
@@ -8,8 +7,3 @@ jobs:
87
runs-on: ubuntu-latest
98
steps:
109
- uses: mkimuram/test-gha/plugins/pony@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
issue_num: ${{ github.event.client_payload.github.payload.issue.number }}
14-
pr_num: ${{ github.event.client_payload.pull_request.number }}
15-
token: ${{secrets.PAT}}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/remove-kind` | `/remove-kind bug` | Removes a kind label. |
21
name: remove kind command
32
on:
43
repository_dispatch:
@@ -8,8 +7,3 @@ jobs:
87
runs-on: ubuntu-latest
98
steps:
109
- uses: mkimuram/test-gha/plugins/remove-kind@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
issue_num: ${{ github.event.client_payload.github.payload.issue.number }}
14-
args: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
15-
token: ${{secrets.PAT}}

.github/workflows/command-reopen.yml

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/reopen` | `/reopen` | Reopens an issue or PR. |
21
name: reopen command
32
on:
43
repository_dispatch:
@@ -8,8 +7,3 @@ jobs:
87
runs-on: ubuntu-latest
98
steps:
109
- uses: mkimuram/test-gha/plugins/reopen@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
issue_num: ${{ github.event.client_payload.github.payload.issue.number }}
14-
pr_num: ${{ github.event.client_payload.pull_request.number }}
15-
token: ${{secrets.PAT}}

.github/workflows/command-retest.yml

-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/retest` | `/retest` | Rerun test jobs that have failed. |
21
name: retest command
32
on:
43
repository_dispatch:
@@ -8,7 +7,3 @@ jobs:
87
runs-on: ubuntu-latest
98
steps:
109
- uses: mkimuram/test-gha/plugins/retest@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
sha: ${{ github.event.client_payload.pull_request.head.sha }}
14-
token: ${{secrets.PAT}}
-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/unassign` | `/unassign`<br> `/unassign spongebob patrick` | Unassigns assignee(s) from the PR. |
21
name: unassign command
32
on:
43
repository_dispatch:
@@ -8,9 +7,3 @@ jobs:
87
runs-on: ubuntu-latest
98
steps:
109
- uses: mkimuram/test-gha/plugins/unassign@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
issue_num: ${{ github.event.client_payload.github.payload.issue.number }}
14-
args: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
15-
actor: ${{ github.actor }}
16-
token: ${{secrets.PAT}}

.github/workflows/command-usage.yml

+1-41
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/usage` | `/usage` | Show usage message. |
21
name: usage command
32
on:
43
repository_dispatch:
@@ -7,43 +6,4 @@ jobs:
76
usage:
87
runs-on: ubuntu-latest
98
steps:
10-
- uses: actions/checkout@v2
11-
- name: Install yq
12-
run: |
13-
sudo wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.6.3/yq_linux_amd64
14-
sudo chmod a+x /usr/local/bin/yq
15-
- name: Update gh
16-
run: |
17-
# Current gh in ubuntu-latest doesn't support -F option
18-
sudo wget -O gh_1.8.1_linux_amd64.tar.gz https://github.com/cli/cli/releases/download/v1.8.1/gh_1.8.1_linux_amd64.tar.gz
19-
sudo tar xvfz gh_1.8.1_linux_amd64.tar.gz
20-
sudo cp gh_1.8.1_linux_amd64/bin/gh /usr/local/bin/gh
21-
sudo chmod a+x /usr/local/bin/gh
22-
- name: Show usage
23-
run: |
24-
wdir=".github/workflows/"
25-
dfile="slash-command-dispatch.yml"
26-
dpath="${wdir}${dfile}"
27-
query='.jobs.slashCommandDispatch.steps[0].with.commands'
28-
29-
function usage_msg() {
30-
echo '| Command | Example | Description |'
31-
echo '| --- | --- | --- |'
32-
while read cmd;do
33-
cpath="${wdir}command-${cmd}.yml"
34-
if [ -e "${cpath}" ];then
35-
grep '^# Usage: ' "${cpath}" | sed 's/# Usage: //'
36-
fi
37-
done <<< $(yq eval "${query}" "${dpath}" | sed '/^$/d')
38-
}
39-
40-
if [ -n "${PR_NUM}" ];then
41-
usage_msg | /usr/local/bin/gh pr comment "${PR_NUM}" -R ${REPO} -F -
42-
else
43-
usage_msg | /usr/local/bin/gh issue comment "${ISSUE_NUM}" -R ${REPO} -F -
44-
fi
45-
env:
46-
REPO: ${{ github.event.client_payload.github.payload.repository.full_name }}
47-
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
48-
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
49-
GITHUB_TOKEN: ${{secrets.PAT}}
9+
- uses: mkimuram/test-gha/plugins/usage@main

.github/workflows/command-woof.yml

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Usage: | `/woof` | `/woof` | Add a dog image to the issue or PR. |
21
name: woof command
32
on:
43
repository_dispatch:
@@ -8,8 +7,3 @@ jobs:
87
runs-on: ubuntu-latest
98
steps:
109
- uses: mkimuram/test-gha/plugins/woof@main
11-
with:
12-
repo: ${{ github.event.client_payload.github.payload.repository.full_name }}
13-
issue_num: ${{ github.event.client_payload.github.payload.issue.number }}
14-
pr_num: ${{ github.event.client_payload.pull_request.number }}
15-
token: ${{secrets.PAT}}

plugins/assign/action.yml

+5-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
name: 'Assign'
22
description: 'Assign to issue or pr'
3-
inputs:
4-
repo:
5-
description: 'Repository name to assign'
6-
required: true
7-
issue_num:
8-
description: 'Issue number to assign'
9-
required: true
10-
args:
11-
description: 'Arguments for slash command'
12-
required: false
13-
actor:
14-
description: 'Github actor'
15-
required: false
16-
token:
17-
description: 'GITHUB_TOKEN to run this action'
18-
required: true
193
runs:
204
using: "composite"
215
steps:
@@ -38,8 +22,8 @@ runs:
3822
echo "{\"assignees\":[${people}]}" | \
3923
gh api repos/${REPO}/issues/${ISSUE_NUM}/assignees -X POST --input -
4024
env:
41-
REPO: ${{ inputs.repo }}
42-
ISSUE_NUM: ${{ inputs.issue_num }}
43-
ARGS: ${{ inputs.args }}
44-
ACTOR: ${{ inputs.actor }}
45-
GITHUB_TOKEN: ${{ inputs.token }}
25+
REPO: ${{ github.repository }}
26+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
27+
ARGS: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
28+
ACTOR: ${{ github.actor }}
29+
GITHUB_TOKEN: ${{ github.token }}

plugins/assign/usage.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| `/assgin` | `/assign`<br> `/assign spongebob patrick` | Assigns assignee(s) to the PR. |

plugins/close/action.yml

+4-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
name: 'Close'
22
description: 'Close issue or pr'
3-
inputs:
4-
repo:
5-
description: 'Repository name to close'
6-
required: true
7-
issue_num:
8-
description: 'Issue number to close'
9-
required: true
10-
pr_num:
11-
description: 'PR number to close'
12-
required: false
13-
token:
14-
description: 'GITHUB_TOKEN to run this action'
15-
required: true
163
runs:
174
using: "composite"
185
steps:
@@ -25,7 +12,7 @@ runs:
2512
gh issue close "${ISSUE_NUM}" -R "${REPO}"
2613
fi
2714
env:
28-
REPO: ${{ inputs.repo }}
29-
ISSUE_NUM: ${{ inputs.issue_num }}
30-
PR_NUM: ${{ inputs.pr_num }}
31-
GITHUB_TOKEN: ${{ inputs.token }}
15+
REPO: ${{ github.repository }}
16+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
17+
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
18+
GITHUB_TOKEN: ${{ github.token }}

plugins/close/usage.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| `/close` | `/close` | Closes an issue or PR. |

plugins/kind/action.yml

+4-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
name: 'Kind'
22
description: 'Add kind label to issue or pr'
3-
inputs:
4-
repo:
5-
description: 'Repository name to add kind label'
6-
required: true
7-
issue_num:
8-
description: 'Issue number to add kind label'
9-
required: true
10-
args:
11-
description: 'Arguments for slash command'
12-
required: true
13-
token:
14-
description: 'GITHUB_TOKEN to run this action'
15-
required: true
163
runs:
174
using: "composite"
185
steps:
@@ -27,7 +14,7 @@ runs:
2714
echo "{\"labels\":[\"${label}\"]}" | \
2815
gh api repos/${REPO}/issues/${ISSUE_NUM}/labels -X POST --input -
2916
env:
30-
REPO: ${{ inputs.repo }}
31-
ISSUE_NUM: ${{ inputs.issue_num }}
32-
ARGS: ${{ inputs.args }}
33-
GITHUB_TOKEN: ${{ inputs.token }}
17+
REPO: ${{ github.repository }}
18+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
19+
ARGS: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
20+
GITHUB_TOKEN: ${{ github.token }}

plugins/kind/usage.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| `/kind` | `/kind bug` | Applies a kind label. |

plugins/meow/action.yml

+4-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
name: 'Meow'
22
description: 'Show a cat image'
3-
inputs:
4-
repo:
5-
description: 'Repository name to show the image'
6-
required: true
7-
issue_num:
8-
description: 'Issue number to show the image'
9-
required: true
10-
pr_num:
11-
description: 'Pr number to show the image'
12-
required: false
13-
token:
14-
description: 'GITHUB_TOKEN to run this action'
15-
required: true
163
runs:
174
using: "composite"
185
steps:
@@ -27,7 +14,7 @@ runs:
2714
gh issue comment "${ISSUE_NUM}" -R ${REPO} -b "${msg}"
2815
fi
2916
env:
30-
REPO: ${{ inputs.repo }}
31-
ISSUE_NUM: ${{ inputs.issue_num }}
32-
PR_NUM: ${{ inputs.pr_num }}
33-
GITHUB_TOKEN: ${{ inputs.token }}
17+
REPO: ${{ github.repository }}
18+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
19+
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
20+
GITHUB_TOKEN: ${{ github.token }}

plugins/meow/usage.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| `/meow` | `/meow` | Add a cat image to the issue or PR. |

plugins/pony/action.yml

+4-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
name: 'Pony'
22
description: 'Show a pony image'
3-
inputs:
4-
repo:
5-
description: 'Repository name to show the image'
6-
required: true
7-
issue_num:
8-
description: 'Issue number to show the image'
9-
required: true
10-
pr_num:
11-
description: 'Pr number to show the image'
12-
required: false
13-
token:
14-
description: 'GITHUB_TOKEN to run this action'
15-
required: true
163
runs:
174
using: "composite"
185
steps:
@@ -27,7 +14,7 @@ runs:
2714
gh issue comment "${ISSUE_NUM}" -R ${REPO} -b "${msg}"
2815
fi
2916
env:
30-
REPO: ${{ inputs.repo }}
31-
ISSUE_NUM: ${{ inputs.issue_num }}
32-
PR_NUM: ${{ inputs.pr_num }}
33-
GITHUB_TOKEN: ${{ inputs.token }}
17+
REPO: ${{ github.repository }}
18+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
19+
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
20+
GITHUB_TOKEN: ${{ github.token }}

plugins/pony/usage.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| `/pony` | `/pony` | Add a pony image to the issue or PR. |

plugins/remove-kind/action.yml

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
name: 'Kind'
1+
name: 'Remove Kind'
22
description: 'Remove kind label from issue or pr'
3-
inputs:
4-
repo:
5-
description: 'Repository name to remove kind label'
6-
required: true
7-
issue_num:
8-
description: 'Issue number to remove kind label'
9-
required: true
10-
args:
11-
description: 'Arguments for slash command'
12-
required: true
13-
token:
14-
description: 'GITHUB_TOKEN to run this action'
15-
required: true
163
runs:
174
using: "composite"
185
steps:
@@ -26,7 +13,7 @@ runs:
2613
label="kind/${ARGS}"
2714
gh api repos/${REPO}/issues/${ISSUE_NUM}/labels/${label} -X DELETE
2815
env:
29-
REPO: ${{ inputs.repo }}
30-
ISSUE_NUM: ${{ inputs.issue_num }}
31-
ARGS: ${{ inputs.args }}
32-
GITHUB_TOKEN: ${{ inputs.token }}
16+
REPO: ${{ github.repository }}
17+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
18+
ARGS: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
19+
GITHUB_TOKEN: ${{ github.token }}

plugins/remove-kind/usage.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| `/remove-kind` | `/remove-kind bug` | Removes a kind label. |

0 commit comments

Comments
 (0)