Created
November 24, 2025 13:19
-
-
Save miminashi/7c922ea9eea182146319367f2fd83e7f to your computer and use it in GitHub Desktop.
GitHub Issue のURLを貼ると内容をmarkdownにしてくれるシェルスクリプト。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # https://claude.ai/share/b16220a4-da07-4309-9658-93d28a7c407a | |
| # | |
| #!/bin/sh | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 <github-issue-url>" >&2 | |
| echo "Example: $0 https://github.com/owner/repo/issues/123" >&2 | |
| exit 1 | |
| fi | |
| # URLからREPOとISSUE_NUMを抽出 | |
| URL="$1" | |
| REPO=$(echo "$URL" | sed -n 's|https://github.com/\([^/]*/[^/]*\)/issues/.*|\1|p') | |
| ISSUE_NUM=$(echo "$URL" | sed -n 's|.*/issues/\([0-9]*\).*|\1|p') | |
| if [ -z "$REPO" ] || [ -z "$ISSUE_NUM" ]; then | |
| echo "Error: Invalid GitHub issue URL" >&2 | |
| exit 1 | |
| fi | |
| # issueの基本情報 | |
| curl -s -H "Accept: application/vnd.github.v3+json" \ | |
| "https://api.github.com/repos/${REPO}/issues/${ISSUE_NUM}" | \ | |
| jq -r '"# Issue #\(.number)\n\n## Title\n\(.title)\n\n## Author\n\(.user.login)\n\n## Created\n\(.created_at)\n\n## State\n\(.state)\n\n## Description\n\(.body)\n\n## Timeline\n"' | |
| # タイムラインイベント | |
| curl -s -H "Accept: application/vnd.github.v3+json" \ | |
| "https://api.github.com/repos/${REPO}/issues/${ISSUE_NUM}/timeline" | \ | |
| jq -r '.[] | | |
| "### \(.created_at)\n" + | |
| if .event == "labeled" then | |
| "- **\(.actor.login)** added label **\(.label.name)**" | |
| elif .event == "unlabeled" then | |
| "- **\(.actor.login)** removed label **\(.label.name)**" | |
| elif .event == "closed" then | |
| "- **\(.actor.login)** closed this as completed" | |
| elif .event == "commented" then | |
| "Comment by \(.user.login)\n\n\(.body)" | |
| elif .event == "assigned" then | |
| "- **\(.actor.login)** assigned \(.assignee.login)" | |
| elif .event == "unassigned" then | |
| "- **\(.actor.login)** unassigned \(.assignee.login)" | |
| elif .event == "reopened" then | |
| "- **\(.actor.login)** reopened this" | |
| elif .event == "renamed" then | |
| "- **\(.actor.login)** renamed from \"\(.rename.from)\" to \"\(.rename.to)\"" | |
| elif .event == "subscribed" then | |
| "- **\(.actor.login)** subscribed" | |
| elif .event == "unsubscribed" then | |
| "- **\(.actor.login)** unsubscribed" | |
| else | |
| "- **\(.actor.login // "system")** \(.event)" | |
| end + "\n"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment