Skip to content

Commit eafe0e3

Browse files
committed
Fix promote-rc git call and update workflow args
The promote-rc command was failing because it called Git.get_commit_sha with an invalid keyword argument 'remote_ref'. This fixes the call and updates the tests. It also updates the workflow to use '=' for passing arguments as requested.
1 parent 0896b47 commit eafe0e3

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/release_promote_rc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ jobs:
5252
ARGS+=("$VERSION")
5353
fi
5454
if [ -n "$ISSUE" ]; then
55-
ARGS+=("--issue" "$ISSUE")
55+
ARGS+=("--issue=$ISSUE")
5656
fi
57-
ARGS+=("--remote" "origin")
57+
ARGS+=("--remote=origin")
5858
ARGS+=("--no-dry-run")
5959
6060
bazel run //tools/private/release -- promote-rc "${ARGS[@]}"

tests/tools/private/release/promote_rc_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_promote_rc_success(self):
3434
]
3535
)
3636
self.mock_git.get_commit_sha.assert_has_calls(
37-
[call("2.0.0-rc1"), call(remote_ref="my-remote/release/2.0")]
37+
[call("2.0.0-rc1"), call("my-remote/release/2.0")]
3838
)
3939
self.mock_git.checkout.assert_not_called()
4040
self.mock_git.tag_exists.assert_called_once_with("2.0.0")
@@ -85,7 +85,7 @@ def test_promote_rc_resolve_issue_success(self):
8585
)
8686
self.mock_gh.get_release_tracking_issue.assert_called_once_with("2.0.0")
8787
self.mock_git.get_commit_sha.assert_has_calls(
88-
[call("2.0.0-rc1"), call(remote_ref="my-remote/release/2.0")]
88+
[call("2.0.0-rc1"), call("my-remote/release/2.0")]
8989
)
9090
self.mock_git.checkout.assert_not_called()
9191
self.mock_git.tag.assert_called_once_with("2.0.0", "abcdef123456")
@@ -136,7 +136,7 @@ def test_promote_rc_resolves_version_from_issue(self):
136136

137137
self.mock_git.checkout.assert_not_called()
138138
self.mock_git.get_commit_sha.assert_has_calls(
139-
[call("2.0.1-rc0"), call(remote_ref="my-remote/release/2.0")]
139+
[call("2.0.1-rc0"), call("my-remote/release/2.0")]
140140
)
141141
self.mock_git.tag.assert_called_once_with("2.0.1", "12345678")
142142
self.mock_git.push.assert_called_once_with("my-remote", "2.0.1")
@@ -181,7 +181,7 @@ def test_promote_rc_dry_run_success(self, mock_print):
181181
]
182182
)
183183
self.mock_git.get_commit_sha.assert_has_calls(
184-
[call("2.0.0-rc1"), call(remote_ref="my-remote/release/2.0")]
184+
[call("2.0.0-rc1"), call("my-remote/release/2.0")]
185185
)
186186
self.mock_git.tag_exists.assert_called_once_with("2.0.0")
187187

tools/private/release/promote_rc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def run(self) -> int:
8989
print(f"Fetching remote branch {remote_branch}...")
9090
self.git.fetch(args.remote, refspec=branch_name)
9191
try:
92-
branch_sha = self.git.get_commit_sha(remote_ref=remote_branch)
92+
branch_sha = self.git.get_commit_sha(remote_branch)
9393
except Exception as e:
9494
print(
9595
f"Error: Could not get commit SHA for remote branch"

0 commit comments

Comments
 (0)