Skip to content

Commit

Permalink
ci: Fix plan not generated correctly for PR from forked repo (#3327)
Browse files Browse the repository at this point in the history
* ci: Fix plan not generated correctly for PR from forked repo

Signed-off-by: Xuanwo <[email protected]>

* Fix

Signed-off-by: Xuanwo <[email protected]>

---------

Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored Oct 17, 2023
1 parent 5d2cb57 commit 27526e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 27526e3

Please sign in to comment.