Try to use set-output

because commit info are not necessary in env.
This commit is contained in:
Kazuhiro NISHIYAMA 2019-12-11 14:01:23 +09:00
parent 6025783a3b
commit 7fa821a80d
No known key found for this signature in database
GPG Key ID: 262ED8DBB4222F7A
6 changed files with 16 additions and 13 deletions

View File

@ -54,10 +54,9 @@ jobs:
git -C src reset --hard ${{ github.event.pull_request.head.sha }} git -C src reset --hard ${{ github.event.pull_request.head.sha }}
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
shell: cmd shell: cmd
- name: Actions-commit-info.sh - run: ./src/tool/actions-commit-info.sh
run: | shell: bash
bash ./src/tool/actions-commit-info.sh id: commit_info
shell: cmd
- name: Autoconf - name: Autoconf
run: | run: |
cd src cd src

View File

@ -35,6 +35,7 @@ jobs:
GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }} GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }}
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
- run: ./src/tool/actions-commit-info.sh - run: ./src/tool/actions-commit-info.sh
id: commit_info
- name: Install libraries - name: Install libraries
run: | run: |
export WAITS='5 60' export WAITS='5 60'
@ -69,7 +70,7 @@ jobs:
payload: | payload: |
{ {
"attachments": [{ "attachments": [{
"text": "${{ job.status }}: ${{ github.workflow }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ env.COMMIT_DATE }} #${{ env.COMMIT_NUMBER_OF_DAY }}> " + "text": "${{ job.status }}: ${{ github.workflow }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ steps.commit_info.outputs.COMMIT_DATE }} #${{ steps.commit_info.outputs.COMMIT_NUMBER_OF_DAY }}> " +
"(<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|" + "${{ github.sha }}".substring(0, 10) + ">) " + "(<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 }}", "of ${{ github.repository }}@" + "${{ github.ref }}".split('/').reverse()[0] + " by ${{ github.event.head_commit.committer.name }}",
"color": "danger" "color": "danger"

View File

@ -36,6 +36,7 @@ jobs:
GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }} GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }}
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
- run: ./src/tool/actions-commit-info.sh - run: ./src/tool/actions-commit-info.sh
id: commit_info
- name: Fixed world writable dirs - name: Fixed world writable dirs
run: | run: |
chmod go-w $HOME chmod go-w $HOME
@ -67,7 +68,7 @@ jobs:
payload: | payload: |
{ {
"attachments": [{ "attachments": [{
"text": "${{ job.status }}: ${{ github.workflow }} / ${{ matrix.jit_opts }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ env.COMMIT_DATE }} #${{ env.COMMIT_NUMBER_OF_DAY }}> " + "text": "${{ job.status }}: ${{ github.workflow }} / ${{ matrix.jit_opts }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ steps.commit_info.outputs.COMMIT_DATE }} #${{ steps.commit_info.outputs.COMMIT_NUMBER_OF_DAY }}> " +
"(<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|" + "${{ github.sha }}".substring(0, 10) + ">) " + "(<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 }}", "of ${{ github.repository }}@" + "${{ github.ref }}".split('/').reverse()[0] + " by ${{ github.event.head_commit.committer.name }}",
"color": "danger" "color": "danger"

View File

@ -68,6 +68,7 @@ jobs:
GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }} GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }}
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
- run: ./src/tool/actions-commit-info.sh - run: ./src/tool/actions-commit-info.sh
id: commit_info
- name: Fixed world writable dirs - name: Fixed world writable dirs
run: | run: |
chmod go-w $HOME chmod go-w $HOME
@ -103,7 +104,7 @@ jobs:
payload: | payload: |
{ {
"attachments": [{ "attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ env.COMMIT_DATE }} #${{ env.COMMIT_NUMBER_OF_DAY }}> " + "text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ steps.commit_info.outputs.COMMIT_DATE }} #${{ steps.commit_info.outputs.COMMIT_NUMBER_OF_DAY }}> " +
"(<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|" + "${{ github.sha }}".substring(0, 10) + ">) " + "(<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 }}", "of ${{ github.repository }}@" + "${{ github.ref }}".split('/').reverse()[0] + " by ${{ github.event.head_commit.committer.name }}",
"color": "danger" "color": "danger"

View File

@ -50,6 +50,7 @@ jobs:
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
- run: ./src/tool/actions-commit-info.sh - run: ./src/tool/actions-commit-info.sh
shell: bash shell: bash
id: commit_info
- name: Configure - name: Configure
run: | run: |
md build md build
@ -78,7 +79,7 @@ jobs:
payload: | payload: |
{ {
"attachments": [{ "attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ env.COMMIT_DATE }} #${{ env.COMMIT_NUMBER_OF_DAY }}> " + "text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ steps.commit_info.outputs.COMMIT_DATE }} #${{ steps.commit_info.outputs.COMMIT_NUMBER_OF_DAY }}> " +
"(<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|" + "${{ github.sha }}".substring(0, 10) + ">) " + "(<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 }}", "of ${{ github.repository }}@" + "${{ github.ref }}".split('/').reverse()[0] + " by ${{ github.event.head_commit.committer.name }}",
"color": "danger" "color": "danger"

View File

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