1+ name : Dispatch Staff Label Feedback
2+
3+ on :
4+ discussion :
5+ types :
6+ - labeled
7+ - unlabeled
8+
9+ permissions :
10+ contents : read
11+
12+ jobs :
13+ dispatch-feedback-event :
14+ runs-on : ubuntu-latest
15+ env :
16+ COMMUNITY_OPS_REPOSITORY : community/community-ops
17+ steps :
18+ - name : Forward discussion label events
19+ uses : actions/github-script@v8
20+ with :
21+ github-token : ${{ secrets.COMMUNITY_OPS_DISPATCH_TOKEN }}
22+ script : |
23+ const actor = context.actor;
24+ const action = context.payload.action;
25+ const discussion = context.payload.discussion;
26+ const label = context.payload.label;
27+
28+ if (!label?.name) {
29+ core.info("Skipping event with missing label");
30+ return;
31+ }
32+
33+ if (!discussion?.number) {
34+ throw new Error("Missing discussion number in discussion event payload");
35+ }
36+
37+ if ((actor || "").endsWith("[bot]")) {
38+ core.info(`Skipping bot-generated event: ${actor}`);
39+ return;
40+ }
41+
42+ const [owner, repo] = process.env.COMMUNITY_OPS_REPOSITORY.split("/");
43+ await github.rest.repos.createDispatchEvent({
44+ owner,
45+ repo,
46+ event_type: "staff-label-correction",
47+ client_payload: {
48+ source_repository: `${context.repo.owner}/${context.repo.repo}`,
49+ target_repository: `${context.repo.owner}/${context.repo.repo}`,
50+ discussion_number: discussion.number,
51+ discussion_title: discussion.title || "unknown",
52+ discussion_url: discussion.html_url || discussion.url || "",
53+ category: discussion.category?.name || "unknown",
54+ category_slug: discussion.category?.slug || "unknown",
55+ event_type: action,
56+ label: label.name,
57+ actor,
58+ createdAt: new Date().toISOString(),
59+ },
60+ });
61+
62+ core.info(`Forwarded ${action} event for discussion #${discussion.number}`);
0 commit comments