ruby-changes:58768
From: Kazuhiro <ko1@a...>
Date: Wed, 13 Nov 2019 14:25:47 +0900 (JST)
Subject: [ruby-changes:58768] c4064aef7f (master): Add commit number of today to notification of GitHub Actions
https://git.ruby-lang.org/ruby.git/commit/?id=c4064aef7f From c4064aef7f48c51add6c24467da64528d5a2a2a5 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA <zn@m...> Date: Wed, 13 Nov 2019 13:22:46 +0900 Subject: Add commit number of today to notification of GitHub Actions diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 319e40b..d7437a2 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -34,6 +34,7 @@ jobs: https://github.com/ruby/ruby/blob/trunk/.github/workflows/macos.yml#L34 GITHUB_BRANCH: ${{ github.event.pull_request.head.ref }} GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }} if: github.event_name == 'pull_request' + - run: ./src/tool/actions-commit-info.sh - name: Install libraries run: | export WAITS='5 60' @@ -67,7 +68,7 @@ jobs: https://github.com/ruby/ruby/blob/trunk/.github/workflows/macos.yml#L68 payload: | { "attachments": [{ - "text": "${{ job.status}}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ github.workflow }} / ${{ matrix.test_task }}> " + + "text": "${{ job.status }}: ${{ env.COMMIT_DATE }}-${{ env.COMMIT_NUMBER_OF_DAY }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ github.workflow }} / ${{ matrix.test_task }}> " + "(<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|" + "${{ github.sha }}".substring(0, 10) + ">) " + "of ${{ github.repository }}@" + "${{ github.ref }}".split('/').reverse()[0] + " by ${{ github.event.head_commit.committer.name }}", "color": "danger" diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index f02be6f..1a59bc3 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -67,6 +67,7 @@ jobs: https://github.com/ruby/ruby/blob/trunk/.github/workflows/ubuntu.yml#L67 GITHUB_BRANCH: ${{ github.event.pull_request.head.ref }} GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }} if: github.event_name == 'pull_request' + - run: ./src/tool/actions-commit-info.sh - name: Fixed world writable dirs run: | chmod go-w $HOME @@ -96,7 +97,7 @@ jobs: https://github.com/ruby/ruby/blob/trunk/.github/workflows/ubuntu.yml#L97 payload: | { "attachments": [{ - "text": "${{ job.status}}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ matrix.os }} / ${{ matrix.test_task }}> " + + "text": "${{ job.status }}: ${{ env.COMMIT_DATE }}-${{ env.COMMIT_NUMBER_OF_DAY }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ matrix.os }} / ${{ matrix.test_task }}> " + "(<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|" + "${{ github.sha }}".substring(0, 10) + ">) " + "of ${{ github.repository }}@" + "${{ github.ref }}".split('/').reverse()[0] + " by ${{ github.event.head_commit.committer.name }}", "color": "danger" diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 0b4c41d..efa371d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -54,6 +54,8 @@ jobs: https://github.com/ruby/ruby/blob/trunk/.github/workflows/windows.yml#L54 git clone --depth=50 --branch=${{ github.event.pull_request.head.ref }} https://github.com/${{ github.event.pull_request.head.repo.full_name }} src git -C src reset --hard ${{ github.event.pull_request.head.sha }} if: github.event_name == 'pull_request' + - run: ./src/tool/actions-commit-info.sh + shell: bash - name: Configure run: | md build @@ -80,7 +82,7 @@ jobs: https://github.com/ruby/ruby/blob/trunk/.github/workflows/windows.yml#L82 payload: | { "attachments": [{ - "text": "${{ job.status}}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ matrix.os }} (vs${{ matrix.vs }}) / ${{ matrix.test_task }}> " + + "text": "${{ job.status }}: ${{ env.COMMIT_DATE }}-${{ env.COMMIT_NUMBER_OF_DAY }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ matrix.os }} (vs${{ matrix.vs }}) / ${{ matrix.test_task }}> " + "(<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|" + "${{ github.sha }}".substring(0, 10) + ">) " + "of ${{ github.repository }}@" + "${{ github.ref }}".split('/').reverse()[0] + " by ${{ github.event.head_commit.committer.name }}", "color": "danger" diff --git a/tool/actions-commit-info.sh b/tool/actions-commit-info.sh new file mode 100755 index 0000000..c44f7d4 --- /dev/null +++ b/tool/actions-commit-info.sh @@ -0,0 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/tool/actions-commit-info.sh#L1 +#!/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)" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/