diff --git a/.github/actions/createOrUpdateStagingDeploy/index.js b/.github/actions/createOrUpdateStagingDeploy/index.js index 8483d44a0ac2..613ccb0401cb 100644 --- a/.github/actions/createOrUpdateStagingDeploy/index.js +++ b/.github/actions/createOrUpdateStagingDeploy/index.js @@ -195,7 +195,7 @@ const {execSync} = __nccwpck_require__(3129); * @returns {Object<{commit: String, subject: String}>} */ function getMergeLogsAsJSON(fromRef, toRef) { - const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}^...${toRef}`; + const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}...${toRef}`; console.log('Getting pull requests merged between the following refs:', fromRef, toRef); console.log('Running command: ', command); const result = execSync(command).toString().trim(); diff --git a/.github/actions/getDeployPullRequestList/index.js b/.github/actions/getDeployPullRequestList/index.js index 7e2880c8f1c6..0832734cc5cd 100644 --- a/.github/actions/getDeployPullRequestList/index.js +++ b/.github/actions/getDeployPullRequestList/index.js @@ -117,7 +117,7 @@ const {execSync} = __nccwpck_require__(3129); * @returns {Object<{commit: String, subject: String}>} */ function getMergeLogsAsJSON(fromRef, toRef) { - const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}^...${toRef}`; + const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}...${toRef}`; console.log('Getting pull requests merged between the following refs:', fromRef, toRef); console.log('Running command: ', command); const result = execSync(command).toString().trim(); diff --git a/.github/libs/GitUtils.js b/.github/libs/GitUtils.js index 73377ad61b38..7ecf06d3a840 100644 --- a/.github/libs/GitUtils.js +++ b/.github/libs/GitUtils.js @@ -9,7 +9,7 @@ const {execSync} = require('child_process'); * @returns {Object<{commit: String, subject: String}>} */ function getMergeLogsAsJSON(fromRef, toRef) { - const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}^...${toRef}`; + const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}...${toRef}`; console.log('Getting pull requests merged between the following refs:', fromRef, toRef); console.log('Running command: ', command); const result = execSync(command).toString().trim(); diff --git a/tests/unit/getPullRequestsMergedBetweenTest.sh b/tests/unit/getPullRequestsMergedBetweenTest.sh index a8f9daa612d8..f6622b226f17 100755 --- a/tests/unit/getPullRequestsMergedBetweenTest.sh +++ b/tests/unit/getPullRequestsMergedBetweenTest.sh @@ -125,7 +125,7 @@ git tag "$(print_version)" git checkout main success "Created new tag $(print_version)" -# Verify output +# Verify output for checklist and deploy comment info "Checking output of getPullRequestsMergedBetween 1.0.1 1.0.2" output=$(node "$getPullRequestsMergedBetween" '1.0.1' '1.0.2') assert_equal "$output" "[ '1' ]" @@ -165,11 +165,16 @@ git checkout staging git tag "$(print_version)" success "Successfully created tag $(print_version)" -# Verify output +# Verify output for checklist info "Checking output of getPullRequestsMergedBetween 1.0.1 1.1.0" output=$(node "$getPullRequestsMergedBetween" '1.0.1' '1.1.0') assert_equal "$output" "[ '1' ]" +# Verify output for deploy comment +info "Checking output of getPullRequestsMergedBetween 1.0.2 1.1.0" +output=$(node "$getPullRequestsMergedBetween" '1.0.2' '1.1.0') +assert_equal "$output" "[]" + success "Scenario #2 completed successfully!" @@ -234,11 +239,16 @@ git checkout staging git tag "$(print_version)" success "Created tag $(print_version)" -# Verify output +# Verify output for checklist info "Checking output of getPullRequestsMergedBetween 1.0.1 1.1.1" output=$(node "$getPullRequestsMergedBetween" '1.0.1' '1.1.1') assert_equal "$output" "[ '9', '7', '1' ]" +# Verify output for deploy comment +info "Checking output of getPullRequestsMergedBetween 1.1.0 1.1.1" +output=$(node "$getPullRequestsMergedBetween" '1.1.0' '1.1.1') +assert_equal "$output" "[ '9', '7' ]" + success "Scenario #4 completed successfully!" @@ -255,6 +265,7 @@ info "Merged PR #10 into production" git branch -d update-production-from-staging success "Updated production from staging!" +# Verify output for release body and production deploy comments info "Checking output of getPullRequestsMergedBetween 1.0.1 1.1.1" output=$(node "$getPullRequestsMergedBetween" '1.0.1' '1.1.1') assert_equal "$output" "[ '9', '7', '1' ]" @@ -290,9 +301,10 @@ git checkout staging git tag "$(print_version)" success "Successfully tagged version $(print_version) on staging" +# Verify output for new checklist and staging deploy comments info "Checking output of getPullRequestsMergedBetween 1.1.1 1.1.2" output=$(node "$getPullRequestsMergedBetween" '1.1.1' '1.1.2') -assert_equal "$output" "[ '9', '6' ]" +assert_equal "$output" "[ '6' ]" success "Scenario #5B completed successfully!" @@ -338,9 +350,15 @@ git checkout staging git tag "$(print_version)" success "Successfully tagged version $(print_version) on staging" +# Verify output for checklist info "Checking output of getPullRequestsMergedBetween 1.1.1 1.1.3" output=$(node "$getPullRequestsMergedBetween" '1.1.1' '1.1.3') -assert_equal "$output" "[ '13', '9', '6' ]" +assert_equal "$output" "[ '13', '6' ]" + +# Verify output for deploy comment +info "Checking output of getPullRequestsMergedBetween 1.1.2 1.1.3" +output=$(node "$getPullRequestsMergedBetween" '1.1.2' '1.1.3') +assert_equal "$output" "[ '13' ]" success "Scenario #6 completed successfully!"