From 4e707cba04e4b9e3ce4110c4af6dc748322a7f6b Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 7 Mar 2023 21:15:29 +0000 Subject: [PATCH] Allow jobs on forks which have self hosted runners setup. Signed-off-by: Pedro Algarvio --- tools/ci.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/ci.py b/tools/ci.py index 5bf725f83f6..e074ff9b2c5 100644 --- a/tools/ci.py +++ b/tools/ci.py @@ -196,7 +196,10 @@ def runner_types(ctx: Context, event_name: str): # This is a push or a scheduled event ctx.info(f"Running from a {event_name!r} event") - if gh_event["repository"]["fork"] is True: + if ( + gh_event["repository"]["fork"] is True + and os.environ.get("FORK_HAS_SELF_HOSTED_RUNNERS", "0") == "1" + ): # This is running on a forked repository, don't run tests ctx.info("The push event is on a forked repository") runners["github-hosted"] = True @@ -205,7 +208,7 @@ def runner_types(ctx: Context, event_name: str): wfh.write(f"runners={json.dumps(runners)}\n") ctx.exit(0) - # Not running on a fork, run everything + # Not running on a fork, or the fork has self hosted runners, run everything ctx.info(f"The {event_name!r} event is from the main repository") runners["github-hosted"] = runners["self-hosted"] = True ctx.info("Writing 'runners' to the github outputs file")