mirror of
https://github.com/GTNewHorizons/GTNH-Actions-Workflows.git
synced 2026-07-15 12:29:55 +02:00
Switch out pr url lookup method with repos/repo/pulls + filter (#71)
This commit is contained in:
parent
219d11877b
commit
8d2e9d2fcf
@ -34,10 +34,14 @@ jobs:
|
||||
id: lookup
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} # Not inlined below to prevent injection from branch names
|
||||
run: |
|
||||
PR_URL=$(gh api \
|
||||
"repos/${{ github.repository }}/commits/${{ github.event.workflow_run.head_sha }}/pulls" \
|
||||
--jq "[.[] | select(.head.sha == \"${{ github.event.workflow_run.head_sha }}\" and .state == \"open\")] | first | .html_url // empty")
|
||||
PR_URL=$(gh api --method GET \
|
||||
"repos/${{ github.repository }}/pulls" \
|
||||
-f state=open \
|
||||
-f head="${{ github.event.workflow_run.head_repository.owner.login }}:${HEAD_BRANCH}" \
|
||||
-f base="${{ github.event.repository.default_branch }}" \
|
||||
--jq "([.[] | select(.head.sha == \"${{ github.event.workflow_run.head_sha }}\")] | first | .html_url) // (first | .html_url) // empty")
|
||||
|
||||
if [ -z "$PR_URL" ]; then
|
||||
echo "Failed to find a PR url"
|
||||
|
||||
10
.github/workflows/trigger-rebuild-with-deps.yml
vendored
10
.github/workflows/trigger-rebuild-with-deps.yml
vendored
@ -23,10 +23,14 @@ jobs:
|
||||
id: lookup
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} # Not inlined below to prevent injection from branch names
|
||||
run: |
|
||||
PR_URL=$(gh api \
|
||||
"repos/${{ github.repository }}/commits/${{ github.event.workflow_run.head_sha }}/pulls" \
|
||||
--jq "[.[] | select(.head.sha == \"${{ github.event.workflow_run.head_sha }}\" and .state == \"open\")] | first | .html_url // empty")
|
||||
PR_URL=$(gh api --method GET \
|
||||
"repos/${{ github.repository }}/pulls" \
|
||||
-f state=open \
|
||||
-f head="${{ github.event.workflow_run.head_repository.owner.login }}:${HEAD_BRANCH}" \
|
||||
-f base="${{ github.event.repository.default_branch }}" \
|
||||
--jq "([.[] | select(.head.sha == \"${{ github.event.workflow_run.head_sha }}\")] | first | .html_url) // (first | .html_url) // empty")
|
||||
|
||||
if [ -z "$PR_URL" ]; then
|
||||
echo "Failed to find a PR url"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user