Skip to content

Commit

Permalink
use command arg for pr-sha
Browse files Browse the repository at this point in the history
  • Loading branch information
suzhoum committed Dec 19, 2024
1 parent 3b30353 commit fb7b96f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/slash_command_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb7b96f

Please sign in to comment.