Closed faithandbrave closed 4 months ago
{
"message": "Problems parsing JSON",
"documentation_url": "https://docs.github.com/rest/issues/issues#create-an-issue"
}
うーん?
issue作るスクリプトそのものは大丈夫ですね・・・。
https://github.com/yumetodo/site/issues/1
$./create_github_issue_when_not_empty.sh a.txt *** yumetodo/site aaa
{
"url": "https://api.github.com/repos/yumetodo/site/issues/1",
"repository_url": "https://api.github.com/repos/yumetodo/site",
"labels_url": "https://api.github.com/repos/yumetodo/site/issues/1/labels{/name}",
"comments_url": "https://api.github.com/repos/yumetodo/site/issues/1/comments",
"events_url": "https://api.github.com/repos/yumetodo/site/issues/1/events",
"html_url": "https://github.com/yumetodo/site/issues/1",
"id": 2142433987,
"node_id": "I_kwDOBOm_7M5_svLD",
"number": 1,
"title": "outer link check failed at aaa",
"user": {
"login": "yumetodo",
"id": 10869046,
"node_id": "MDQ6VXNlcjEwODY5MDQ2",
"avatar_url": "https://avatars.githubusercontent.com/u/10869046?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/yumetodo",
"html_url": "https://github.com/yumetodo",
"followers_url": "https://api.github.com/users/yumetodo/followers",
"following_url": "https://api.github.com/users/yumetodo/following{/other_user}",
"gists_url": "https://api.github.com/users/yumetodo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/yumetodo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/yumetodo/subscriptions",
"organizations_url": "https://api.github.com/users/yumetodo/orgs",
"repos_url": "https://api.github.com/users/yumetodo/repos",
"events_url": "https://api.github.com/users/yumetodo/events{/privacy}",
"received_events_url": "https://api.github.com/users/yumetodo/received_events",
"type": "User",
"site_admin": false
},
"labels": [
],
"state": "open",
"locked": false,
"assignee": null,
"assignees": [
],
"milestone": null,
"comments": 0,
"created_at": "2024-02-19T13:56:39Z",
"updated_at": "2024-02-19T13:56:39Z",
"closed_at": null,
"author_association": "OWNER",
"active_lock_reason": null,
"body": "The commit hash was: _aaa_.\n\na\n",
"closed_by": null,
"reactions": {
"url": "https://api.github.com/repos/yumetodo/site/issues/1/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"timeline_url": "https://api.github.com/repos/yumetodo/site/issues/1/timeline",
"performed_via_github_app": null,
"state_reason": null
}
多分Issue本文として載せてるtxtファイルがjsonとしてvalidじゃなくさせているのだと思うので、とりあえずatficatに出してみようとcommit足してみました
対応ありがとうございます!そしたら、いったん様子見ですかね
あ、そんな事する必要なかった、なぜなら本文のtxtはtee
コマンドでコンソールに出しているから。
$cat a.txt
URL http://www.mpir.org/ not found. requests.exceptions.ConnectionError : HTTPConnectionPool(host='www.mpir.org', port=80): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7f57e8e85f10>: Failed to resolve 'www.mpir.org' ([Errno -2] Name or service not known)")) from:['third_party_library.md']
URL https://github.com/cpprefjp/image/raw/master/reference/random/lognormal_distribution/lognormal_distribution.tsv.7z not found. 404 from:['reference/random/lognormal_distribution.md']
$./create_github_issue_when_not_empty.sh a.txt *** yumetodo/site aaa
{
"message": "Problems parsing JSON",
"documentation_url": "https://docs.github.com/rest/issues/issues#create-an-issue"
}
再現しましたね
JSONの組み立てを見直すべきそう
@faithandbrave jsonの組み立てをシェルスクリプトでどうにかするのが面倒なのでpythonで書き直してみました。
手元で動かして作ったIssueが https://github.com/yumetodo/site/issues/3 です。
もっとも、私はpythonを書いたことが殆どないので、この書き方でいいのか自信がないですが・・・(ほとんどBing Copilotにかかせた・・・)
if [ "$(wc -l < "$1")" -eq 0 ]; then
exit 0
fi
このへんの処理(check_result.txtが空だったら何もしない)がPython側スクリプトになかったようなので足しました。
無事に動くようになったようです。
@yumetodo 対応ありがとうございました。
あっ・・・、成功時にissue作らなくするのは見落としてました、ありがとうございます
https://github.com/cpprefjp/site/actions/workflows/outer_link_check.yml
CIが失敗しても、バッジも更新されていない模様。 内部リンクチェックもissue発行していませんが困っていないので、外部リンクチェックもissue発行しなくていいかもしれません。