David Arthur created KAFKA-18968:
------------------------------------
Summary: Workflow Requested not working for pull_request_reviewed
events
Key: KAFKA-18968
URL: https://issues.apache.org/jira/browse/KAFKA-18968
Project: Kafka
Issue Type: Bug
Components: build
Reporter: David Arthur
We use the Workflow Requested workflow to automatically approve workflows from
the community if the "ci-approved" label is set.
Due to a quirk (deficiency) of the GitHub events schema, there is no easy way
to determine the Pull Request for a given workflow. We previously did the
following for pull_request events:
{code:java}
PR_NUMBER=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/$REPO/pulls?head=$HEAD_REPO:$HEAD_BRANCH \
--jq '.[0].number'){code}
However, this does not work with pull_request_reviewed events since the
HEAD_REPO is set to apache/kafka instead of the PR's origin repository (another
annoying "quirk" of the GH API).
We need some way to figure out the Pull Request number from a workflow_run
"requested" event type. The flow should be:
* pull_request_reviewed is requested due to a review being done
* Workflow Requested runs, discovers PR number somehow
* Check PR for "ci-approved" label
* If label set, approve pending pull_request_reviewed workflow run
--
This message was sent by Atlassian Jira
(v8.20.10#820010)