From 07517ce501c12e75da03d325c23968d75ac37d00 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 23 Oct 2023 18:47:48 +0900 Subject: [PATCH] try to get pull request id from github.event.workflow_run.pull_requests --- .github/workflows/report-api-diff.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/report-api-diff.yml b/.github/workflows/report-api-diff.yml index 55d13100fb..adc18858a4 100644 --- a/.github/workflows/report-api-diff.yml +++ b/.github/workflows/report-api-diff.yml @@ -39,7 +39,14 @@ jobs: run: unzip api-artifact.zip -d artifacts - name: Load PR Number id: load-pr-num - run: echo "pr-number=$(cat artifacts/pr_number)" >> "$GITHUB_OUTPUT" + env: + PULL_REQUESTS: ${{ toJson(github.event.workflow_run.pull_requests.*) }} + REPO_ID: ${{ github.repository_id }} + run: | + # find first pull requests that targets this repository + PR_NUMBER="$(echo "$PULL_REQUESTS" + | jq --arg REPO_ID "$REPO_ID" '[.[] | select ($REPO_ID == (.base.repo.id | tostring)) | .id ][0]')" + echo "pr-number=$PR_NUMBER" >> "$GITHUB_OUTPUT" - name: Output base run: cat ./artifacts/api-base.json