@@ -63,7 +63,9 @@ async function handleIssueCommentCreate({ github, context }) {
6363 )
6464 return
6565 }
66- const command = commentBody . split ( ' ' ) [ 0 ]
66+ const commandArray = commentBody . split ( ' ' )
67+ const command = commandArray [ 0 ]
68+ const params = commandArray . length > 1 ? commandArray [ 1 ] : undefined
6769
6870 // Commands that can be executed by anyone.
6971 if ( command === '/assign' ) {
@@ -81,11 +83,10 @@ async function handleIssueCommentCreate({ github, context }) {
8183
8284 switch ( command ) {
8385 case '/ok-to-test' :
84- await cmdOkToTest ( github , issue , isFromPulls )
86+ await cmdOkToTest ( github , issue , isFromPulls , params )
8587 break
86- case command . match ( / ^ \/ r e r u n \d + / ) ?. input :
87- const workflowrunid = command . match ( / \d + / ) [ 0 ] ;
88- await rerunWorkflow ( github , issue , workflowrunid )
88+ case '/rerun' :
89+ await rerunWorkflow ( github , issue , params )
8990 break
9091 default :
9192 console . log (
@@ -171,8 +172,9 @@ async function cmdAssign(github, issue, username, isFromPulls) {
171172 * @param {* } github GitHub object reference
172173 * @param {* } issue GitHub issue object
173174 * @param {boolean } isFromPulls is the workflow triggered by a pull request?
175+ * @param {string } pattern is a expression to filter components
174176 */
175- async function cmdOkToTest ( github , issue , isFromPulls ) {
177+ async function cmdOkToTest ( github , issue , isFromPulls , pattern ) {
176178 if ( ! isFromPulls ) {
177179 console . log (
178180 '[cmdOkToTest] only pull requests supported, skipping command execution.'
@@ -193,6 +195,7 @@ async function cmdOkToTest(github, issue, isFromPulls) {
193195 pull_head_ref : pull . data . head . sha ,
194196 pull_head_repo : pull . data . head . repo . full_name ,
195197 command : 'ok-to-test' ,
198+ pattern : pattern ,
196199 issue : issue ,
197200 }
198201
0 commit comments