Find the GitHub workflows that have been run on a PR (fork, check-suite, check-runs) #138619
Replies: 4 comments
-
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.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Hello, Tracking workflows in PRs from forked repositories with GitHub Actions is limited, especially since the base and head repositories are different. However, for specific commit SHAs, you can use the check-suites and check-runs APIs to see which check suites completed or failed successfully. To keep track of workflows in fork PRs, you may need to make separate API calls for both repos. You can safely rerun workflows using a GitHub app to retrigger them. You can refer to GitHub Community Discussions for more information and solutions on this subject. |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
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