From 8d5310f8628a75814d27fd3d2e2259b45b11d470 Mon Sep 17 00:00:00 2001 From: Szilard Parrag Date: Thu, 3 Oct 2024 09:38:26 +0200 Subject: [PATCH] ci: fix cfg-grammar's PR ID query The owner is only needed if it's coming from a fork Signed-off-by: Szilard Parrag --- .github/workflows/comment-cfg-grammar-changes.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/comment-cfg-grammar-changes.yml b/.github/workflows/comment-cfg-grammar-changes.yml index 6e4bbe3ce1..2ac603755f 100644 --- a/.github/workflows/comment-cfg-grammar-changes.yml +++ b/.github/workflows/comment-cfg-grammar-changes.yml @@ -48,7 +48,11 @@ jobs: # There is also no json field in the `gh run view` command, which could give us the PR ID, so we can only query it based on the fork and branch. # See https://github.com/orgs/community/discussions/25220 - PR_ID=$(gh pr view -R "${{ github.repository }}" "${{ github.event.workflow_run.head_repository.owner.login }}:${{ github.event.workflow_run.head_branch }}" --json "number" --jq ".number") + OWNER="${{ github.event.workflow_run.head_repository.owner.login }}" + if [[ "${OWNER}" == "axoflow" ]]; then + PR_ID=$(gh pr view -R "${{ github.repository }}" "${{ github.event.workflow_run.head_branch }}" --json "number" --jq ".number") + else + PR_ID=$(gh pr view -R "${{ github.repository }}" "${OWNER}":"${{ github.event.workflow_run.head_branch }}" --json "number" --jq ".number") echo "pr-id=${PR_ID}" >> $GITHUB_OUTPUT - name: Update or remove PR comment