mirror of
https://github.com/GTNewHorizons/GTNH-Actions-Workflows.git
synced 2026-09-01 03:47:30 +02:00
Switch out pr url lookup method with repos/repo/pulls + filter (#71)
This commit is contained in:
@@ -34,10 +34,14 @@ jobs:
|
|||||||
id: lookup
|
id: lookup
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} # Not inlined below to prevent injection from branch names
|
||||||
run: |
|
run: |
|
||||||
PR_URL=$(gh api \
|
PR_URL=$(gh api --method GET \
|
||||||
"repos/${{ github.repository }}/commits/${{ github.event.workflow_run.head_sha }}/pulls" \
|
"repos/${{ github.repository }}/pulls" \
|
||||||
--jq "[.[] | select(.head.sha == \"${{ github.event.workflow_run.head_sha }}\" and .state == \"open\")] | first | .html_url // empty")
|
-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
|
if [ -z "$PR_URL" ]; then
|
||||||
echo "Failed to find a PR url"
|
echo "Failed to find a PR url"
|
||||||
|
|||||||
@@ -23,10 +23,14 @@ jobs:
|
|||||||
id: lookup
|
id: lookup
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} # Not inlined below to prevent injection from branch names
|
||||||
run: |
|
run: |
|
||||||
PR_URL=$(gh api \
|
PR_URL=$(gh api --method GET \
|
||||||
"repos/${{ github.repository }}/commits/${{ github.event.workflow_run.head_sha }}/pulls" \
|
"repos/${{ github.repository }}/pulls" \
|
||||||
--jq "[.[] | select(.head.sha == \"${{ github.event.workflow_run.head_sha }}\" and .state == \"open\")] | first | .html_url // empty")
|
-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
|
if [ -z "$PR_URL" ]; then
|
||||||
echo "Failed to find a PR url"
|
echo "Failed to find a PR url"
|
||||||
|
|||||||
Reference in New Issue
Block a user