Skip to content

Commit 2447b0d

Browse files
committed
Add lgtm
Signed-off-by: Masaki Kimura <[email protected]>
1 parent c8003e1 commit 2447b0d

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

.github/workflows/command-lgtm.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: lgtm command
2+
on:
3+
repository_dispatch:
4+
types: [lgtm-command]
5+
jobs:
6+
lgtm:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: mkimuram/test-gha/plugins/lgtm@main

.github/workflows/slash-command-dispatch.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
unassign
1919
kind
2020
remove-kind
21+
lgtm
2122
retest
2223
meow
2324
woof

plugins/lgtm/action.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Lgtm'
2+
description: 'Add lgtm label to pr'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Add lgtm label to pr
7+
shell: bash
8+
run: |
9+
label="lgtm"
10+
# lgtm is only for pr
11+
[ -n "${PR_NUM}" ] || false
12+
# TODO: Check if actor has right to lgtm
13+
# If no args add lgtm label
14+
if [ -z "${ARGS}" ];then
15+
echo "{\"labels\":[\"${label}\"]}" | \
16+
gh api repos/${REPO}/issues/${ISSUE_NUM}/labels -X POST --input -
17+
# If args is cancel remove lgtm label
18+
elif [[ "${ARGS}" == "cancel" ]];then
19+
gh api repos/${REPO}/issues/${ISSUE_NUM}/labels/${label} -X DELETE
20+
fi
21+
env:
22+
REPO: ${{ github.repository }}
23+
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }}
24+
PR_NUM: ${{ github.event.client_payload.pull_request.number }}
25+
ARGS: ${{ github.event.client_payload.slash_command.args.unnamed.all }}
26+
GITHUB_TOKEN: ${{ github.token }}

plugins/lgtm/usage.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| `/lgtm` | `/lgtm [cancel] ` | Adds or removes the 'lgtm' label which is typically used to gate merging. |

0 commit comments

Comments
 (0)