mirror of
https://github.com/Respect/Validation.git
synced 2026-03-14 14:25:45 +01:00
Add TheRespectPanda Bot workflow
Includes a basic bot workflow that just answers "pong" to ping requests, includes a help message and ignores invalid commands. This is the minimum feature that exercises token access, non recursive comments (answering to its own pong) and so on.
This commit is contained in:
parent
305a7d15db
commit
19b80ce7b1
1 changed files with 43 additions and 0 deletions
43
.github/workflows/panda.yml
vendored
Normal file
43
.github/workflows/panda.yml
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
name: TheRespectPanda Bot
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
if: startsWith(github.event.comment.body, '@TheRespectPanda')
|
||||
|
||||
jobs:
|
||||
listen-comment:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
github-token: ${{ secrets.PANDA_GITHUB_PAT }}
|
||||
script: |
|
||||
const body = (context.payload.comment && context.payload.comment.body).trim() || '';
|
||||
const usage = 'Usage: `@TheRespectPanda ping|help`';
|
||||
|
||||
if (!body.startsWith('@TheRespectPanda')) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (body) {
|
||||
case '@TheRespectPanda ping':
|
||||
answer = 'Pong! 🐼';
|
||||
break;
|
||||
case '@TheRespectPanda':
|
||||
case '@TheRespectPanda help':
|
||||
answer = 'Hello! I am TheRespectPanda Bot. ' + usage;
|
||||
break;
|
||||
default:
|
||||
answer = "I'm sorry, I don't understand that command. " + usage;
|
||||
}
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: answer
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue