Skip to content

Commit

Permalink
New workflow_dispatch for building wheels for a PR
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Apr 22, 2023
1 parent 8bc6712 commit 3bc2cb7
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build_wheels_for_pr.yml
@@ -0,0 +1,28 @@
name: Build and Upload Wheels for PR

on:
workflow_dispatch:

jobs:

check_for_pr:
runs-on: ubuntu-latest
outputs:
PR_NUMBER: ${{ steps.get_pr.outputs.PR_NUMBER }}
steps:
- name: Check if commit belongs to a PR
id: get_pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pr_number=$(curl --silent --header "Authorization: Bearer ${GITHUB_TOKEN}" \
--url "https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/pulls" \
| jq '.[] | .number')
if [ -z "$pr_number" ]; then
echo "No PR associated with this commit"
exit 1
else
echo "Commit is associated with PR: $pr_number"
echo "PR_NUMBER=$pr_number" >> "$GITHUB_OUTPUTS"
fi

0 comments on commit 3bc2cb7

Please sign in to comment.