diff --git a/.github/workflows/slash_command_dispatch.yml b/.github/workflows/slash_command_dispatch.yml index 727a92a..96bcb84 100644 --- a/.github/workflows/slash_command_dispatch.yml +++ b/.github/workflows/slash_command_dispatch.yml @@ -13,13 +13,14 @@ jobs: with: result-encoding: string script: | - const { owner, repo, number } = context.issue; - const pr = await github.rest.pulls.get({ - owner, - repo, - pull_number: number, - }); - return pr.data.head.sha + const body = context.payload.comment.body.trim(); + const commandRegex = /^\/platform_tests\s+([a-f0-9]{40})$/; + const match = body.match(commandRegex); + if (!match) { + throw new Error("Invalid command format. Please provide a full 40-character SHA as an argument."); + } + console.log(`Extracted SHA: "${match[1]}"`); + return match[1]; - name: Get PR number id: pr_number uses: actions/github-script@v7