Skip to content

Commit 67302fc

Browse files
authored
Merge pull request #7161 from Expensify/Rory-FixDuplicateDeployComment
[No QA] Add separate assertions for deploy comments, fix bug
2 parents 64faaaa + 01326e1 commit 67302fc

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

.github/actions/createOrUpdateStagingDeploy/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const {execSync} = __nccwpck_require__(3129);
195195
* @returns {Object<{commit: String, subject: String}>}
196196
*/
197197
function getMergeLogsAsJSON(fromRef, toRef) {
198-
const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}^...${toRef}`;
198+
const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}...${toRef}`;
199199
console.log('Getting pull requests merged between the following refs:', fromRef, toRef);
200200
console.log('Running command: ', command);
201201
const result = execSync(command).toString().trim();

.github/actions/getDeployPullRequestList/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const {execSync} = __nccwpck_require__(3129);
117117
* @returns {Object<{commit: String, subject: String}>}
118118
*/
119119
function getMergeLogsAsJSON(fromRef, toRef) {
120-
const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}^...${toRef}`;
120+
const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}...${toRef}`;
121121
console.log('Getting pull requests merged between the following refs:', fromRef, toRef);
122122
console.log('Running command: ', command);
123123
const result = execSync(command).toString().trim();

.github/libs/GitUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const {execSync} = require('child_process');
99
* @returns {Object<{commit: String, subject: String}>}
1010
*/
1111
function getMergeLogsAsJSON(fromRef, toRef) {
12-
const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}^...${toRef}`;
12+
const command = `git log --format='{"commit": "%H", "subject": "%s"},' ${fromRef}...${toRef}`;
1313
console.log('Getting pull requests merged between the following refs:', fromRef, toRef);
1414
console.log('Running command: ', command);
1515
const result = execSync(command).toString().trim();

tests/unit/getPullRequestsMergedBetweenTest.sh

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ git tag "$(print_version)"
125125
git checkout main
126126
success "Created new tag $(print_version)"
127127

128-
# Verify output
128+
# Verify output for checklist and deploy comment
129129
info "Checking output of getPullRequestsMergedBetween 1.0.1 1.0.2"
130130
output=$(node "$getPullRequestsMergedBetween" '1.0.1' '1.0.2')
131131
assert_equal "$output" "[ '1' ]"
@@ -165,11 +165,16 @@ git checkout staging
165165
git tag "$(print_version)"
166166
success "Successfully created tag $(print_version)"
167167

168-
# Verify output
168+
# Verify output for checklist
169169
info "Checking output of getPullRequestsMergedBetween 1.0.1 1.1.0"
170170
output=$(node "$getPullRequestsMergedBetween" '1.0.1' '1.1.0')
171171
assert_equal "$output" "[ '1' ]"
172172

173+
# Verify output for deploy comment
174+
info "Checking output of getPullRequestsMergedBetween 1.0.2 1.1.0"
175+
output=$(node "$getPullRequestsMergedBetween" '1.0.2' '1.1.0')
176+
assert_equal "$output" "[]"
177+
173178
success "Scenario #2 completed successfully!"
174179

175180

@@ -234,11 +239,16 @@ git checkout staging
234239
git tag "$(print_version)"
235240
success "Created tag $(print_version)"
236241

237-
# Verify output
242+
# Verify output for checklist
238243
info "Checking output of getPullRequestsMergedBetween 1.0.1 1.1.1"
239244
output=$(node "$getPullRequestsMergedBetween" '1.0.1' '1.1.1')
240245
assert_equal "$output" "[ '9', '7', '1' ]"
241246

247+
# Verify output for deploy comment
248+
info "Checking output of getPullRequestsMergedBetween 1.1.0 1.1.1"
249+
output=$(node "$getPullRequestsMergedBetween" '1.1.0' '1.1.1')
250+
assert_equal "$output" "[ '9', '7' ]"
251+
242252
success "Scenario #4 completed successfully!"
243253

244254

@@ -255,6 +265,7 @@ info "Merged PR #10 into production"
255265
git branch -d update-production-from-staging
256266
success "Updated production from staging!"
257267

268+
# Verify output for release body and production deploy comments
258269
info "Checking output of getPullRequestsMergedBetween 1.0.1 1.1.1"
259270
output=$(node "$getPullRequestsMergedBetween" '1.0.1' '1.1.1')
260271
assert_equal "$output" "[ '9', '7', '1' ]"
@@ -290,9 +301,10 @@ git checkout staging
290301
git tag "$(print_version)"
291302
success "Successfully tagged version $(print_version) on staging"
292303

304+
# Verify output for new checklist and staging deploy comments
293305
info "Checking output of getPullRequestsMergedBetween 1.1.1 1.1.2"
294306
output=$(node "$getPullRequestsMergedBetween" '1.1.1' '1.1.2')
295-
assert_equal "$output" "[ '9', '6' ]"
307+
assert_equal "$output" "[ '6' ]"
296308

297309
success "Scenario #5B completed successfully!"
298310

@@ -338,9 +350,15 @@ git checkout staging
338350
git tag "$(print_version)"
339351
success "Successfully tagged version $(print_version) on staging"
340352

353+
# Verify output for checklist
341354
info "Checking output of getPullRequestsMergedBetween 1.1.1 1.1.3"
342355
output=$(node "$getPullRequestsMergedBetween" '1.1.1' '1.1.3')
343-
assert_equal "$output" "[ '13', '9', '6' ]"
356+
assert_equal "$output" "[ '13', '6' ]"
357+
358+
# Verify output for deploy comment
359+
info "Checking output of getPullRequestsMergedBetween 1.1.2 1.1.3"
360+
output=$(node "$getPullRequestsMergedBetween" '1.1.2' '1.1.3')
361+
assert_equal "$output" "[ '13' ]"
344362

345363
success "Scenario #6 completed successfully!"
346364

0 commit comments

Comments
 (0)