Entry IDをURLから抽出する処理が末尾にのみマッチするよう修正 #18
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
概要
EditURLからEntry IDを抽出する処理について、usernameやURLのprefixに数字が含まれる場合にEntry IDが正常に取得できなくなる場合があるので、それを修正しました。
詳細
例: 以下のケースでEntry IDが正しく抽出されません
blogsync後、ディレクトリ構造が以下のようになっている
133117.md
の内容は以下のようになっているこの時、
.github/actions/move-draft-and-update-metadata/action.yaml
と.github/actions/pull-draft-by-title/action.yaml
の処理において、yq --front-matter=extract '.EditURL' "$file" | grep -oP '[^/]+\d'
というコマンドが実行されますが、以下のようになります。これは
grep -oP '[^/]+\d'
がhttps://blog.hatena.ne.jp/uta8a/uta8a.hatenablog.com/atom/entry/820878482972134901
のuta8a
部分にもマッチしてしまうためです修正案
$
を足して末尾のみにマッチするようにしました