From 88358c58764d3cc88e4bbae79c272ef57b9fead2 Mon Sep 17 00:00:00 2001 From: Bhavin Patel Date: Tue, 30 Jul 2024 15:44:05 -0700 Subject: [PATCH 1/3] updating fork checkout --- .github/workflows/unit-testing.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 4f51b0b1cb..2079c6951b 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -36,11 +36,9 @@ jobs: echo "Current Branch (Head Ref): ${{ github.head_ref }}" echo "Target Branch (Base Ref): ${{ github.base_ref }}" git pull > /dev/null 2>&1 - git fetch origin pull/${{ github.event.pull_request.number }}/head:${{ github.head_ref }} - #We must specifically get the PR's target branch from security_content, not the one that resides in the fork PR's forked repo - git switch ${{ github.head_ref }} - #git checkout ${{ github.head_ref }} - #echo "The target branch for this PR is ${{ github.base_ref }}" + git fetch origin pull/${{ github.event.pull_request.number }}/head:new_forked_branch + #We must specifically get the PR's target branch from security_content, not the one that resides in the fork PR's forked repo + git switch new_forked_branch contentctl test --disable-tqdm --no-enable-integration-testing --post-test-behavior never_pause mode:changes --mode.target-branch ${{ github.base_ref }} echo "contentctl test - COMPLETED" continue-on-error: true From 6158cad4afbfbe6d9d5b448ea0dba5d4884a2fcc Mon Sep 17 00:00:00 2001 From: Bhavin Patel Date: Tue, 30 Jul 2024 15:47:32 -0700 Subject: [PATCH 2/3] testing for forks --- .github/workflows/unit-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 2079c6951b..0a16df0aac 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -36,9 +36,9 @@ jobs: echo "Current Branch (Head Ref): ${{ github.head_ref }}" echo "Target Branch (Base Ref): ${{ github.base_ref }}" git pull > /dev/null 2>&1 - git fetch origin pull/${{ github.event.pull_request.number }}/head:new_forked_branch + git fetch origin pull/${{ github.event.pull_request.number }}/head:new_forked_branch_for_testing #We must specifically get the PR's target branch from security_content, not the one that resides in the fork PR's forked repo - git switch new_forked_branch + git switch new_forked_branch_for_testing contentctl test --disable-tqdm --no-enable-integration-testing --post-test-behavior never_pause mode:changes --mode.target-branch ${{ github.base_ref }} echo "contentctl test - COMPLETED" continue-on-error: true From 7ad026121a63dbb4d444b4da16f2a726ccaf9cf8 Mon Sep 17 00:00:00 2001 From: Bhavin Patel Date: Wed, 31 Jul 2024 16:18:41 -0700 Subject: [PATCH 3/3] branch name --- .github/workflows/unit-testing.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 0a16df0aac..9293c32204 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -36,9 +36,10 @@ jobs: echo "Current Branch (Head Ref): ${{ github.head_ref }}" echo "Target Branch (Base Ref): ${{ github.base_ref }}" git pull > /dev/null 2>&1 - git fetch origin pull/${{ github.event.pull_request.number }}/head:new_forked_branch_for_testing + #We checkout into a new branch - new_branch_for_testing to avoid name collisions with develop incase the forked PR is from develop + git fetch origin pull/${{ github.event.pull_request.number }}/head:new_branch_for_testing #We must specifically get the PR's target branch from security_content, not the one that resides in the fork PR's forked repo - git switch new_forked_branch_for_testing + git switch new_branch_for_testing contentctl test --disable-tqdm --no-enable-integration-testing --post-test-behavior never_pause mode:changes --mode.target-branch ${{ github.base_ref }} echo "contentctl test - COMPLETED" continue-on-error: true @@ -63,4 +64,4 @@ jobs: run: | echo "This job will fail if there are failures in unit-testing" python .github/workflows/format_test_results.py >> $GITHUB_STEP_SUMMARY - echo "The Unit testing is completed. See details in the unit-testing job summary UI " \ No newline at end of file + echo "The Unit testing is completed. See details in the unit-testing job summary UI "