Skip to content

Commit b10d98b

Browse files
committed
chore: Improve dapr bot
/ok-to-test pattern command added Signed-off-by: Javier Aliaga <[email protected]>
1 parent 8e9f571 commit b10d98b

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

.github/scripts/dapr_bot.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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(/^\/rerun \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

.github/workflows/certification.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ jobs:
5656
run: |
5757
if [ -z "$VAULT_NAME" ]; then
5858
# Do not include cloud tests when credentials are not available
59-
node .github/scripts/test-info.mjs certification false
59+
node .github/scripts/test-info.mjs certification false ${{ github.event.client_payload.issue.pattern }}
6060
else
6161
# Include cloud tests
62-
node .github/scripts/test-info.mjs certification true
62+
node .github/scripts/test-info.mjs certification true ${{ github.event.client_payload.issue.pattern }}
6363
fi
6464
6565
- name: Create PR comment

.github/workflows/conformance.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ jobs:
5959
run: |
6060
if [ -z "$VAULT_NAME" ]; then
6161
# Do not include cloud tests when credentials are not available
62-
node .github/scripts/test-info.mjs conformance false
62+
node .github/scripts/test-info.mjs conformance false ${{ github.event.client_payload.issue.pattern }}
6363
else
6464
# Include cloud tests
65-
node .github/scripts/test-info.mjs conformance true
65+
node .github/scripts/test-info.mjs conformance true ${{ github.event.client_payload.issue.pattern }}
6666
fi
6767
6868
- name: Create PR comment

0 commit comments

Comments
 (0)