Files
wehub-resource-sync 161ef94b4f
Check engine pin consistency / Dockerfile / CI pin consistency (push) Successful in 8s
Sirius CI/CD Pipeline / Detect Changes (push) Successful in 23s
Validate Docker Configuration / Validate Docker Compose Configuration (push) Successful in 47s
Sirius CI/CD Pipeline / Build API (${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Build UI (${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Engine Manifest (push) Has been cancelled
Sirius CI/CD Pipeline / Merge API Manifest (push) Has been cancelled
Sirius CI/CD Pipeline / Merge UI Manifest (push) Has been cancelled
Sirius CI/CD Pipeline / Build Engine (${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Build Infra (${{ matrix.service }}, ${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Infra Manifest (sirius-postgres) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Infra Manifest (sirius-rabbitmq) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Infra Manifest (sirius-valkey) (push) Has been cancelled
Sirius CI/CD Pipeline / Integration Test (push) Has been cancelled
Sirius CI/CD Pipeline / Public Stack Contract (push) Has been cancelled
Sirius CI/CD Pipeline / Dispatch Demo Deployment (sirius-demo branch) (push) Has been cancelled
Sirius CI/CD Pipeline / Dispatch Demo Canary (main branch) (push) Has been cancelled
Sirius CI/CD Pipeline / Guard Registry Namespace (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:32:25 +08:00

66 lines
2.0 KiB
YAML

name: Slash Command Dispatch
on:
issue_comment:
types: [created]
permissions:
contents: write
issues: read
pull-requests: read
jobs:
dispatch:
name: Dispatch chatops command
runs-on: ubuntu-latest
if: >
github.event.issue.pull_request || !github.event.issue.pull_request
steps:
- name: Validate and dispatch
uses: actions/github-script@v7
with:
script: |
const commentBody = (context.payload.comment.body || "").trim();
const assoc = context.payload.comment.author_association || "";
const allowedAssociations = new Set(["OWNER", "MEMBER", "COLLABORATOR"]);
if (!commentBody.startsWith("/")) {
core.info("Not a slash command, skipping.");
return;
}
if (!allowedAssociations.has(assoc)) {
core.info(`Ignoring slash command from association: ${assoc}`);
return;
}
const isSupported =
commentBody.startsWith("/triage ") ||
commentBody === "/triage" ||
commentBody.startsWith("/test ");
if (!isSupported) {
core.info(`Unsupported slash command: ${commentBody}`);
return;
}
const issueNumber = context.payload.issue.number;
const isPr = !!context.payload.issue.pull_request;
const prNumber = isPr ? issueNumber : null;
await github.request("POST /repos/{owner}/{repo}/dispatches", {
owner: context.repo.owner,
repo: context.repo.repo,
event_type: "chatops-command",
client_payload: {
command: commentBody,
issue_number: issueNumber,
pr_number: prNumber,
is_pr: isPr,
comment_id: context.payload.comment.id,
actor: context.actor,
},
});
core.info(`Dispatched chatops command: ${commentBody}`);