Skip to content

Add error status #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 5, 2023
Merged

Add error status #16

merged 2 commits into from
Jul 5, 2023

Conversation

getty104
Copy link
Member

@getty104 getty104 commented Jul 5, 2023

What

increments/qiita-discussions#496 への対応を行う

How

  • publishコマンド実行時に、エラーがあった場合はエラーステータスで実行を停止するようにした
    • 今まではエラーのある記事のみが投稿されないようになっていたが、以降は一つでもエラーのある記事があった場合は実行に失敗するようになる
  • frontmatterのチェックもpublishコマンド実行時も行うようにした

Why

Refs

@getty104 getty104 requested review from a team and acronhub and removed request for a team July 5, 2023 06:05
@getty104 getty104 self-assigned this Jul 5, 2023
Copy link
Contributor

@acronhub acronhub left a comment

Choose a reason for hiding this comment

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

コメントしました

@@ -45,7 +46,12 @@ export const publish = async (argv: string[]) => {
// Validate
const invalidItemMessages = targetItems.reduce((acc, item) => {
const errors = validateItem(item);
Copy link
Contributor

Choose a reason for hiding this comment

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

📝 動作確認

こんな感じのデータ。タグを未記入にする

---
title: newArticle001
tags:
private: true
updated_at: '2023-07-05T15:17:19+09:00'
id: aae380a27065a68d52d9
organization_url_name: null
---

validateItem(item) 内で0 < tags.length && tags.length <= 5の部分でエラーでました

TypeError: Cannot read properties of null (reading 'length')
    at Object.isValid (/Users/h-3109/Documents/workspace/pj-qiita/qiita-cli/dist/lib/validators/item-validator.js:40:25)
    at /Users/h-3109/Documents/workspace/pj-qiita/qiita-cli/dist/lib/validators/item-validator.js:53:24

QiitaPreviewだと、item-validator.jsの前にエラーにして処理がいかないようにしています。

Copy link
Member Author

Choose a reason for hiding this comment

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

修正しました 🙏

@getty104 getty104 requested a review from acronhub July 5, 2023 06:42
Copy link
Contributor

@acronhub acronhub left a comment

Choose a reason for hiding this comment

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

LGTM

📝 動作確認 🆗

@getty104 getty104 force-pushed the add-error-status branch from 517826b to dc0238d Compare July 5, 2023 07:13
@getty104 getty104 merged commit 7deaf07 into main Jul 5, 2023
@getty104 getty104 deleted the add-error-status branch July 5, 2023 07:15
@getty104 getty104 mentioned this pull request Jul 5, 2023
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