File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -128,9 +128,9 @@ let exitCode = 0
128128type PromptFiles = Awaited < ReturnType < typeof getUserPrompt > > [ "promptFiles" ]
129129
130130try {
131- await assertOpencodeConnected ( )
132-
133131 assertContextEvent ( "issue_comment" )
132+ assertPayloadKeyword ( )
133+ await assertOpencodeConnected ( )
134134
135135 accessToken = await getAccessToken ( )
136136 octoRest = new Octokit ( { auth : accessToken } )
@@ -241,6 +241,14 @@ function createOpencode() {
241241 }
242242}
243243
244+ function assertPayloadKeyword ( ) {
245+ const payload = useContext ( ) . payload as IssueCommentEvent
246+ const body = payload . comment . body . trim ( )
247+ if ( ! body . match ( / (?: ^ | \s ) (?: \/ o p e n c o d e | \/ o c ) (? = $ | \s ) / ) ) {
248+ throw new Error ( "Comments must mention `/opencode` or `/oc`" )
249+ }
250+ }
251+
244252async function assertOpencodeConnected ( ) {
245253 let retry = 0
246254 let connected = false
You can’t perform that action at this time.
0 commit comments