Skip to content

Commit 28c36a6

Browse files
committed
leaderboard.yml: improve commit message
So far it wasn't visible on GitHub, and barely visible at all, that these were automatically created commits. Also improved the code a bit by removing the `else` branch.
1 parent 9ebb189 commit 28c36a6

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

.github/workflows/leaderboard.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,23 @@ jobs:
2828
GIT_USER_NAME: "${{ github.actor }}"
2929
# see https://github.com/actions/checkout#push-a-commit-using-the-built-in-token
3030
GIT_USER_EMAIL: "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
31+
RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
3132
run: |
3233
set -e
33-
if ! git diff --no-patch --exit-code README.md; then
34-
git config --global user.name "${GIT_USER_NAME}"
35-
git config --global user.email "${GIT_USER_EMAIL}"
36-
git commit -am "README.md: update leaderboard"
37-
git push
38-
else
34+
35+
if git diff --no-patch --exit-code README.md; then
3936
echo "README.md unchanged, not committing"
37+
exit 0
4038
fi
4139
40+
{
41+
echo "README.md: update leaderboard"
42+
echo
43+
echo "commit generated automatically from"
44+
echo "${RUN_URL}"
45+
} >/tmp/commit-message.txt
46+
git config --global user.name "${GIT_USER_NAME}"
47+
git config --global user.email "${GIT_USER_EMAIL}"
48+
git commit -a -F /tmp/commit-message.txt
49+
git push
50+

0 commit comments

Comments
 (0)