Skip to content

Commit 340def3

Browse files
committed
fix_env_var
1 parent 96d5ae2 commit 340def3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/workflows/Test-CI-main.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
# Note: `pull_request_target` ensures that the tests run in the context of the `main` branch, not in the user's fork.
1212
branches:
1313
- main
14+
- fix_env_var
1415

1516
workflow_dispatch:
1617

@@ -47,15 +48,15 @@ jobs:
4748
echo "Handling pull_request_target event"
4849
echo "SHOULD_TEST_ALL_FILES=false" >> $GITHUB_ENV
4950
50-
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
51+
if [ "$REPO_NAME" != "${{ github.repository }}" ]; then
5152
echo "PR from a fork detected. Checking out the fork's branch."
52-
git remote add fork 'https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git'
53-
git fetch fork '${{ github.event.pull_request.head.ref }}'
53+
git remote add fork 'https://github.com/$REPO_NAME.git'
54+
git fetch fork "$BRANCH_NAME"
5455
git checkout -B ci-testing-branch FETCH_HEAD # Tested code is comming from this branch (contributer's)
5556
else
5657
echo "PR from the same repository detected. Checking out the branch."
57-
git fetch origin '${{ github.event.pull_request.head.ref }}'
58-
git checkout '${{ github.event.pull_request.head.ref }}'
58+
git fetch origin "$BRANCH_NAME"
59+
git checkout "$BRANCH_NAME"
5960
fi
6061
6162
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
@@ -74,6 +75,9 @@ jobs:
7475
# Debugging: final git status
7576
echo "==== Git status after checkout ===="
7677
git status
78+
env:
79+
REPO_NAME: "${{ github.event.pull_request.head.repo.full_name }}"
80+
BRANCH_NAME: "${{ github.event.pull_request.head.ref }}"
7781

7882
#
7983
# Setup Python

0 commit comments

Comments
 (0)