Find the GitHub workflows that have been run on a PR (fork, check-suite, check-runs) #138619
Unanswered
auriaave
asked this question in
API and Webhooks
Replies: 1 comment
-
Is there a better place I should open this discussion? Is tracking workflows for PRs from fork repositories a known limitation? Thanks. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Select Topic Area
Question
Body
Hi,
When a PR is created where the head is a branch within the same repository (same owner and repository), the list of workflows filtered by the commit SHA (ref) will be enough to list the checks that have been completed (successfully or not).
However, PRs that come from a fork (e.g. base_owner is different from head_owner), the same search will only show the workflows that were run on the context of the base (e.g. because of
pull_request_target
). Workflows that run because ofpull_request
(on the head) or workflows required but that don't have a PR event won't get listed.In this second case, I have found a workaround by listing the check suites for a certain commit SHA (
/owner/repo/commits/{SHA}/check-suites
), so I can see which check suites failed or not.For check suites that are marked with
status=completed, conclusion=action_required
, no further information can be found (e.g. which workflow this check suite may be related to).For check suites marked with
status=completed, conclusion=failure
(orconclusion=success
), we can list the check runs related to the check suite (/owner/repo/check-suites/{CHECK_SUITE_ID}/check-runs
). If a check run is related to a workflow, thedetails_url
will list the same as thehtml_url
, pointing (by default) to the GH page for this check run.An example of a URL in the
details_url
, when a workflow exists:https://github.com/OWNER/REPO/actions/runs/WORKFLOW_ID/job/JOB_ID
The workflow run information can be listed via
/owner/repo/actions/runs/{WORKFLOW_ID}
.If this flow of requests is correct, multiple API requests are required for forked PRs for something that non-forked PRs can retrieve on a single API request.
What is the expectation here? The aim is to retrigger only the failed (or not run) workflows safely via a GitHub App (e.g. when a trusted user issues a command via a PR comment).
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions