-
Notifications
You must be signed in to change notification settings - Fork 78
64 lines (62 loc) · 2.35 KB
/
comment_bot.yml
File metadata and controls
64 lines (62 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Comment Bot
on:
issue_comment:
types: [created, edited]
jobs:
command_check:
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '!check') && (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'MEMBER')
name: Perform Check
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
id-token: write
steps:
- name: Extract address from comment
id: extract
run: |
echo "ADDRESS=$(echo ${{ github.event.comment.body }} | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "⏳ Checking if I can connect and log in to ${{ steps.extract.outputs.ADDRESS }}. Give me a minute..."
})
- name: Checkout ac-server-monitor
uses: actions/checkout@v4
with:
repository: 'amoeba/ac-server-monitor'
path: 'ac-server-monitor'
- name: Build ac-server-monitor
working-directory: ./ac-server-monitor
run: go build
- name: Check server is up
id: check
continue-on-error: true
working-directory: ./ac-server-monitor
run: |
./monitor -check ${{ steps.extract.outputs.ADDRESS }}
- uses: actions/github-script@v6
if: steps.check.outcome == 'success'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "✅ ${{ steps.extract.outputs.ADDRESS }} was up and I was able to log in!"
})
- uses: actions/github-script@v6
if: steps.check.outcome == 'failure'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "🚫 ${{ steps.extract.outputs.ADDRESS }} was down or I couldn't log in."
})