1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add commit number of today to notification of GitHub Actions

This commit is contained in:
Kazuhiro NISHIYAMA 2019-11-13 13:22:46 +09:00 committed by Kazuhiro NISHIYAMA
parent 245977b286
commit c4064aef7f
Notes: git 2019-11-13 14:25:51 +09:00
4 changed files with 24 additions and 3 deletions

17
tool/actions-commit-info.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
cd $(dirname "$0")/..
set_env () {
echo "$1=$2"
echo "::set-env name=$1::$2"
}
COMMIT_TIMESTAMP="$(git log -1 --format=%ct)"
set_env "COMMIT_TIMESTAMP" "$COMMIT_TIMESTAMP"
LOGS=$(TZ=UTC git log --since='0:00' --date=iso-local --format='%cd %s')
echo "commits of today:"
echo "$LOGS"
COUNT=$(echo "$LOGS" | wc -l)
# strip spaces
COUNT=$((0 + COUNT))
set_env "COMMIT_NUMBER_OF_DAY" "$COUNT"
set_env "COMMIT_DATE" "$(TZ=UTC git log --since='0:00' --date=short-local --format=%cd -1)"