Skip to content
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

空白を含むタイトルであっても pull draft を実行可能とする #42

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

hsbt
Copy link
Contributor

@hsbt hsbt commented Nov 29, 2023

https://github.com/hatena/Hatena-Blog-Workflows-Boilerplate/ を用いて、pull draft などを実行して下書きの pull-request を作成可能にして利用しています。

pull draft を実行する際に、下書きのタイトルに空白が含まれている場合に以下のようなエラーが発生します。

Run files=($(git ls-files -o --exclude-standard))
  files=($(git ls-files -o --exclude-standard))
  for file in ${files[@]}; do
    title=$(yq --front-matter=extract '.Title' "$file")
    if [[ "$title" == HatenaBlog Workflows *** ]]; then
      entry_path="$file"
    fi
(snip)
/home/runner/work/_temp/8777282b-d24b-4430-a0ec-040dccafc5d3.sh: line 4: syntax error in conditional expression

*** はまだ公開前のためマスクした文字列です。

タイトルにはどうしても空白が含まれることがあるのと、仮のタイトルを設定して pull draft してからタイトルを正式に書き換えるというのも二度手間なので、空白が含まれていても実行に成功してほしいです。

とりあえず、shell で文字列比較を行う際に double quote で囲むだけでよさそうなので修正してみました。

Copy link
Member

@theoremoon theoremoon left a comment

Choose a reason for hiding this comment

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

ご指摘いかにもでした。修正ありがとうございます

@theoremoon theoremoon merged commit 8fe3a1e into hatena:main Nov 29, 2023
@hsbt hsbt deleted the quote-title branch November 29, 2023 07:50
@hsbt
Copy link
Contributor Author

hsbt commented Nov 29, 2023

merge ありがとうございます。

https://github.com/hatena/hatenablog-workflows/releases/tag/v1.2.5 で空白を含んでいても pull-request が作成されるのを確認しました 🚀

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