Skip to content

Instantly share code, notes, and snippets.

@umihico
Last active July 7, 2023 02:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save umihico/4b131c0a9a521df40abcde701c90cc67 to your computer and use it in GitHub Desktop.
日報テンプレ

README

まずエイリアス登録

# 通常bashバージョン
alias nippo="curl -sL \"https://gist.githubusercontent.com/umihico/4b131c0a9a521df40abcde701c90cc67/raw/nippo.sh?v=$(date +'%s')\" | bash -e"

# エラーした人向けdocker利用バージョン 
alias nippo="curl -sL \"https://gist.githubusercontent.com/umihico/4b131c0a9a521df40abcde701c90cc67/raw/dockered.sh?v=$(date +'%s')\" | bash -e"

使い方

# 前日分を出力したい場合は、export NIPPO_OFFSET=0を1に変えてください。
export NIPPO_OFFSET=0; nippo
#!/bin/bash
set -eu
docker run --rm \
-e GITHUB_TOKEN=$(gh config get -h github.com oauth_token) \
-e NIPPO_OFFSET=${NIPPO_OFFSET} \
-v $(pwd):/app -w /app alpine sh -c \
"apk add curl github-cli jq coreutils && curl -sL \"https://gist.githubusercontent.com/umihico/4b131c0a9a521df40abcde701c90cc67/raw/nippo.sh?v=$(date +'%s')\" | sh -e"
#!/bin/bash
set -eu
export NIPPO_OFFSET=${NIPPO_OFFSET:-0}
NIPPO_DATE_OFFSET=$(date -d "${NIPPO_OFFSET} days ago" +'%Y-%m-%d' || date -v-${NIPPO_OFFSET}d +'%Y-%m-%d')
NIPPO_EXTRA_OFFSET=$(date -d "$((NIPPO_OFFSET+2)) days ago" +'%Y-%m-%d' || date -v-$((NIPPO_OFFSET+2))d +'%Y-%m-%d')
echo "
## 今日作ったプルリク
";
gh search prs --author=@me --created=">${NIPPO_EXTRA_OFFSET}" --json url,createdAt,title | \
jq -r "sort_by(.createdAt) | .[] | select(.createdAt | contains(\"${NIPPO_DATE_OFFSET}\")) | \"- \(.createdAt | strptime(\"%Y-%m-%dT%H:%M:%SZ\") | mktime + (60 * 60 * 9) | strftime(\"%R\")) ✅[\(.title)](\(.url))\"";
echo "
## 今日レビューしたプルリク
";
gh search prs --commenter=@me --created=">${NIPPO_EXTRA_OFFSET}" --json url,createdAt,title,author | \
jq -r ".[] | select(.createdAt | contains(\"${NIPPO_DATE_OFFSET}\")) | \"- [\(.title)](\(.url))\"";
echo "
## 今日やったこと(=相手に提供済)
-
## 今日やっていたこと(=相手に提供前)
-
## 明日やること
- "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment