mirror of
https://github.com/Respect/Validation.git
synced 2026-03-23 02:04:43 +01:00
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.
43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
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
|
|
});
|