From d585f8835e39b383c93c725ec3869799c86f8dfa Mon Sep 17 00:00:00 2001 From: trustno1-coder <361337194+trustno1-coder@users.noreply.github.com> Date: Sat, 28 Nov 2026 17:19:17 -0800 Subject: [PATCH] Game-requests workflow: discussions too, and a short post that names the game and asks where A discussion titled game_scarlett_master.exe asking "Where can i find this exact file?" was missed: the workflow saw issues only, and its rules wanted both in one sentence. Discussions and their comments are answered as issues are (closed and locked through GraphQL). Over every issue, discussion and comment here the new rule answers two more posts, both requests, and nothing else. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01X5CFykxe6G44cMPrmExrcw --- .github/workflows/game-requests.yml | 44 ++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/.github/workflows/game-requests.yml b/.github/workflows/game-requests.yml index b9ec4fb8..433c8ca9 100644 --- a/.github/workflows/game-requests.yml +++ b/.github/workflows/game-requests.yml @@ -1,7 +1,7 @@ # Answers posts asking where to get the game: a dump, its files, the 200+ GB download, CyberLeak, # torrents. It says this cannot be discussed here (GitHub can take the repository down over it). -# An issue that asks is closed and locked; a comment that asks gets a reply. The rules below -# were tested on every issue and comment of this repository. The repository's owner, members and +# An issue or discussion that asks is closed and locked; a comment that asks (on either) gets a reply. The rules below +# were tested on every issue, discussion and comment of this repository. The repository's owner, members and # collaborators are never answered. name: game-requests on: @@ -9,8 +9,13 @@ on: types: [opened] issue_comment: types: [created] + discussion: + types: [created] + discussion_comment: + types: [created] permissions: issues: write + discussions: write jobs: answer: runs-on: ubuntu-latest @@ -36,20 +41,51 @@ jobs: .replace(/```[\s\S]*?```/g, ' ') .replace(/`[^`\n]*`/g, ' ') .split('\n').filter((l) => !/^\s*>/.test(l)).join('\n'); + // A short post that names the game or its files anywhere (the title "game_scarlett_master.exe") + // and asks where or how to get or find something anywhere else ("where can i find this file?"). + const NAMES = new RegExp(GAME, 'i'); + const WHERE = /\b(?:where|how)\b[^.?!\n]{0,25}?\b(?:get|find|download|obtain|grab|buy|acquire)\b/i; const asksForGame = (title, body) => { const text = `${plain(title)}\n${plain(body)}`; - return ASKS.some((re) => re.test(text)); + if (ASKS.some((re) => re.test(text))) return true; + return text.length < 400 && NAMES.test(text) && WHERE.test(text); }; // RULES-END const { owner, repo } = context.repo; const p = context.payload; - const post = p.comment || p.issue; + const post = p.comment || p.issue || p.discussion; if (['OWNER', 'MEMBER', 'COLLABORATOR'].includes(post.author_association)) return; if (post.user.type === 'Bot') return; const who = `@${post.user.login}`; const why = "we can't help with where to get the game, a dump or any of its files, and it can't be " + 'discussed here at all: if this repository is used for that, GitHub can take it down for everyone. ' + "Please don't ask for or post links, torrents or sources here."; + // A discussion, or a comment on one: answered the same way, through GraphQL. + if (p.discussion) { + const d = p.discussion; + const reply = (body) => github.graphql( + 'mutation($id: ID!, $body: String!) { addDiscussionComment(input: {discussionId: $id, body: $body}) { comment { id } } }', + { id: d.node_id, body }); + if (p.comment) { + if (!asksForGame('', p.comment.body)) return; + core.notice(`Answering comment ${p.comment.id} by ${p.comment.user.login} on discussion ${d.number}`); + await reply(`${who} ${why}`); + return; + } + if (!asksForGame(d.title, d.body)) return; + core.notice(`Closing discussion ${d.number} by ${d.user.login}: ${d.title}`); + await reply(`Hi ${who}, ${why}\n\nThis discussion is closed and locked. If you already have your own copy and ` + + 'VIctory has a problem with it, please open an issue with your logs.'); + await github.graphql('mutation($id: ID!) { closeDiscussion(input: {discussionId: $id, reason: OUTDATED}) { discussion { id } } }', + { id: d.node_id }); + try { + await github.graphql('mutation($id: ID!) { lockLockable(input: {lockableId: $id, lockReason: OFF_TOPIC}) { lockedRecord { locked } } }', + { id: d.node_id }); + } catch (e) { + core.warning(`Could not lock discussion ${d.number}: ${e.message}`); + } + return; + } const issue_number = p.issue.number; if (p.comment) { if (!asksForGame('', p.comment.body)) return;