Publish to PyPI #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Slash Command Dispatch | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
slashCommandDispatch: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.issue.pull_request }} | |
steps: | |
- name: Get PR SHA | |
id: sha | |
uses: actions/github-script@v7 | |
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 | |
- name: Get PR number | |
id: pr_number | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const { owner, repo, number } = context.issue; | |
return number | |
- name: Get Forked Repository and Branch | |
id: pr_info | |
run: | | |
# Use the GitHub API to fetch information about the pull request | |
pr_info=$(curl -s -H "Authorization: token ${{ secrets.CICD_PAT }}" \ | |
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.pr_number.outputs.result }}") | |
# Extract the forked repository and branch from the pull request info | |
forked_repo=$(echo "$pr_info" | jq -r '.head.repo.full_name') | |
forked_branch=$(echo "$pr_info" | jq -r '.head.ref') | |
echo "Forked Repository: $forked_repo" | |
echo "Forked Branch: $forked_branch" | |
echo "FORK_NAME=$forked_repo" >> $GITHUB_OUTPUT | |
echo "FORK_BRANCH=$forked_branch" >> $GITHUB_OUTPUT | |
- name: Slash Command Dispatch | |
id: scd | |
uses: peter-evans/slash-command-dispatch@v4 | |
with: | |
token: ${{ secrets.CICD_PAT }} | |
permission: write | |
commands: | | |
platform_tests | |
dispatch-type: workflow | |
static-args: | | |
repository=${{ github.repository }} | |
comment-id=${{ github.event.comment.id }} | |
pr-sha=${{ steps.sha.outputs.result }} | |
branch_or_pr_number=PR-${{ steps.pr_number.outputs.result }} | |
fork_info=${{ steps.pr_info.outputs.FORK_NAME }}|${{ steps.pr_info.outputs.FORK_BRANCH }} | |
- name: Edit comment with error message | |
if: steps.scd.outputs.error-message | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
comment-id: ${{ github.event.comment.id }} | |
body: | | |
> ${{ steps.scd.outputs.error-message }} |