Skip to content

Instantly share code, notes, and snippets.

@shuuji3
Last active July 23, 2024 05:17
Show Gist options
  • Save shuuji3/c4eaecb3b6d86bb41474375bcecf0bca to your computer and use it in GitHub Desktop.
Save shuuji3/c4eaecb3b6d86bb41474375bcecf0bca to your computer and use it in GitHub Desktop.
fish shell script for contributing Vite documentation Japanese translation https://github.com/vitejs/docs-ja
#!/usr/bin/env fish
# Parse args
if count $argv > /dev/null
set issue $argv[1]
else
read -p 'set_color green; echo -n "Issue number"; set_color normal; echo "> "' issue
end
# Create a new branch
git branch -D $issue
git stash
git switch main
git pull --rebase
git switch -c $issue
git rebase --onto remotes/docs-ja/main
git stash pop
# Get commit URL
set commit (gh issue view $issue | grep /commit/)
# Get original commit title
set title (gh issue view $issue --json title -q .title | tr -d '\n' | sed -E 's/^[[:blank:]]*(.+\S)[[:blank:]]*$/\1/')
# Show issue description
gh issue view $issue
# Print PR description
echo "----
$title
resolve #$issue
$commit の反映です。
----"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment