Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
AstrakhantsevaAA committed Nov 20, 2023
1 parent a91b35b commit 5a0c208
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,29 @@ def skip_if_not_active(destination: str) -> None:


def is_running_in_github_fork() -> bool:
is_github_actions = os.environ.get("GITHUB_ACTIONS") == "true"
head_ref = os.environ.get("GITHUB_HEAD_REF", "")
repo = os.environ.get("GITHUB_REPOSITORY_OWNER", "")
ref = os.environ.get("GITHUB_REF", "")
base_ref = os.environ.get("GITHUB_BASE_REF", "")
action_repo = os.environ.get("GITHUB_ACTION_REPOSITORY", "")
actor = os.environ.get("GITHUB_ACTOR")
import os
import json

is_fork = is_github_actions and not head_ref.startswith(repo)
def is_pull_request_from_fork():
event_path = os.environ['GITHUB_EVENT_PATH']

raise Exception(f"{is_github_actions}__{head_ref}__{repo}__{ref}__{base_ref}__{action_repo}__{actor}")
# Extract necessary information from the GitHub Actions event payload
with open(event_path) as f:
event_data = json.load(f)

return is_fork
# Extract the username or GitHub App name that initiated the workflow
actor = os.environ['GITHUB_ACTOR']

# Extract relevant information about the repository and pull request
repo_owner = event_data['repository']['owner']['login']
pr_user = event_data['pull_request']['user']['login']

raise Exception(f"{repo_owner}__{pr_user}__{actor}")

# Check if the pull request user is different from the repository owner
return pr_user != repo_owner

return is_pull_request_from_fork()

skipifspawn = pytest.mark.skipif(
multiprocessing.get_start_method() != "fork", reason="process fork not supported"
Expand Down

0 comments on commit 5a0c208

Please sign in to comment.