Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix plan not generated correctly for PR from forked repo #3327

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/test_planner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ jobs:
event_name="${{ github.event_name }}"
repository="${{ github.repository }}"
files_changed=""
has_secrets="False"
is_push="False"
has_secrets="false"
is_push="false"

# Handle event-specific logic
if [ "$event_name" == "push" ]; then
if [ "$repository" == "apache/incubator-opendal" ]; then
is_push="True"
has_secrets="True"
is_push="true"
has_secrets="true"
fi
elif [ "$event_name" == "pull_request" ]; then
pr_head_repo_fork="${{ github.event.pull_request.head.repo.fork }}"
if [ "$pr_head_repo_fork" != "true" ]; then
has_secrets="True"
has_secrets="true"
fi

git fetch origin main:main
Expand Down
6 changes: 3 additions & 3 deletions scripts/workflow_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def get_provided_cases():
# Check if this workflow needs to read secrets.
#
# We will check if pattern `secrets.XXX` exist in content.
if not bool(os.getenv("GITHUB_HAS_SECRETS")):
cases[:] = [v for v in cases if "secrets." not in v["content"]]
if not os.getenv("GITHUB_HAS_SECRETS") == "true":
cases[:] = [v for v in cases if "secrets" not in v["content"]]

return cases

Expand All @@ -57,7 +57,7 @@ def calculate_core_cases(cases, changed_files):
return cases

# Always run all tests if it is a push event.
if bool(os.getenv("GITHUB_IS_PUSH")):
if os.getenv("GITHUB_IS_PUSH") == "true":
return cases

# If any of the core files changed, we will run all cases.
Expand Down