Skip to content

Commit 881e835

Browse files
authored
[test-only][full-ci] Fix commit_author handling for scheduled workflow runs (#12434)
* fix:get author name also for scheduled job * removed unknown fallback * ci: determine commit author correctly for scheduled workflow * remove commit author name for schedule event
1 parent 17d17a1 commit 881e835

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.github/workflows/gui-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,5 @@ jobs:
175175
CACHE_BUCKET: ${{ env.S3_PUBLIC_CACHE_BUCKET }}
176176
MATRIX_TOKEN: ${{ secrets.MATRIX_TOKEN }}
177177
GITHUB_BUILD_STATUS: ${{ needs.gui-tests.result }}
178+
COMMIT_AUTHOR: ${{ github.event.head_commit.author.name }}
178179
run: bash test/gui/ci/notification_template.sh .

test/gui/ci/notification_template.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ TEST_LOGS=""
1111
BRANCH_NAME="${GITHUB_REF_NAME}"
1212
ROOMID="!rnWsCVUmDHDJbiSPMM:matrix.org"
1313

14-
COMMIT_AUTHOR=$(git log -1 --pretty=format:'%an' 2>/dev/null)
15-
1614
if [ "${GITHUB_BUILD_STATUS}" == "failure" ]; then
1715
BUILD_STATUS="❌️ Failure"
1816
fi
@@ -70,7 +68,10 @@ log_success() {
7068

7169
GITHUB_BUILD_LINK="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
7270

73-
message_html='<b>'$BUILD_STATUS'</b> <a href="'${GITHUB_BUILD_LINK}'">'${GITHUB_REPOSITORY}'#'$COMMIT_SHA_SHORT'</a> ('${BRANCH_NAME}') by <b>'${COMMIT_AUTHOR}'</b> <br> <b>'"${TEST_LOGS}"'</b>'
71+
AUTHOR_NAME=""
72+
[ "$GITHUB_EVENT_NAME" != "schedule" ] && AUTHOR_NAME=" by <b>$COMMIT_AUTHOR</b>"
73+
74+
message_html='<b>'$BUILD_STATUS'</b> <a href="'${GITHUB_BUILD_LINK}'">'${GITHUB_REPOSITORY}'#'$COMMIT_SHA_SHORT'</a> ('${BRANCH_NAME}')'${AUTHOR_NAME}' <br> <b>'"${TEST_LOGS}"'</b>'
7475
message_html=$(echo "$message_html" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g')
7576

7677
log_info "Sending report to the element chat..."

0 commit comments

Comments
 (0)