Skip to content

Conversation

kyontan
Copy link
Member

@kyontan kyontan commented Feb 4, 2025

This PR adds success-if-not-found parameter (default: true) to get-service-versions, so that it won't break deploy workflows if there is no service changed.

Ref:

@kyontan kyontan self-assigned this Feb 4, 2025
@kyontan kyontan requested a review from int128 February 4, 2025 08:48
@kyontan kyontan marked this pull request as ready for review February 4, 2025 08:48

try {
namespaceDirectory = await checkoutNamespaceBranch(inputs)
} catch (error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git コマンドの失敗以外の例外もキャッチしてしまうので、下記の exec からステータスコードを受け取ってチェックする方がよいと思います。

await exec.exec('git', ['checkout', opts.branch], { cwd })


describe('getServiceVersions', () => {
it('returnes empty list if successIfNotFound', async () => {
const result = await getServiceVersions({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ユニットテストはローカルで実行するので、実行環境に依存するコマンドを実行するとテスト結果が不安定になります。
実行環境に依存するテストは E2E テストで行うのが確実ですが、今回のような単純な条件分岐では省略してもよいのではないかと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants