GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — github: add configurable mentions input (#5655) · atondwal/opencode@c137bab

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • github
    • action.yml
  • packages/opencode/src/cli/cmd
    • github.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎github/action.yml‎

Copy file name to clipboardExpand all lines: github/action.yml
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ inputs:
2222
required: false
2323
default: "false"
2424

25+
mentions:
26+
description: "Comma-separated list of trigger phrases (case-insensitive). Defaults to '/opencode,/oc'"
27+
required: false
28+
2529
runs:
2630
using: "composite"
2731
steps:
@@ -57,3 +61,4 @@ runs:
5761
SHARE: ${{ inputs.share }}
5862
PROMPT: ${{ inputs.prompt }}
5963
USE_GITHUB_TOKEN: ${{ inputs.use_github_token }}
64+
MENTIONS: ${{ inputs.mentions }}
Collapse file

‎packages/opencode/src/cli/cmd/github.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/github.ts
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,21 +602,26 @@ export const GithubRunCommand = cmd({
602602
}
603603

604604
const reviewContext = getReviewCommentContext()
605+
const mentions = (process.env["MENTIONS"] || "/opencode,/oc")
606+
.split(",")
607+
.map((m) => m.trim().toLowerCase())
608+
.filter(Boolean)
605609
let prompt = (() => {
606610
const body = payload.comment.body.trim()
607-
if (body === "/opencode" || body === "/oc") {
611+
const bodyLower = body.toLowerCase()
612+
if (mentions.some((m) => bodyLower === m)) {
608613
if (reviewContext) {
609614
return `Review this code change and suggest improvements for the commented lines:\n\nFile: ${reviewContext.file}\nLines: ${reviewContext.line}\n\n${reviewContext.diffHunk}`
610615
}
611616
return "Summarize this thread"
612617
}
613-
if (body.includes("/opencode") || body.includes("/oc")) {
618+
if (mentions.some((m) => bodyLower.includes(m))) {
614619
if (reviewContext) {
615620
return `${body}\n\nContext: You are reviewing a comment on file "${reviewContext.file}" at line ${reviewContext.line}.\n\nDiff context:\n${reviewContext.diffHunk}`
616621
}
617622
return body
618623
}
619-
throw new Error("Comments must mention `/opencode` or `/oc`")
624+
throw new Error(`Comments must mention ${mentions.map((m) => "`" + m + "`").join(" or ")}`)
620625
})()
621626

622627
// Handle images

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.