respect-validation/.github/workflows/panda.yml
Alexandre Gomes Gaigalas 5d43388354 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.
2026-02-10 18:24:50 +00:00

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
});