From 8d411cd8ad76bfdfb4105785e43ed86e02337708 Mon Sep 17 00:00:00 2001 From: Jules Belveze <32683010+JulesBelveze@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:33:11 +0100 Subject: [PATCH] [.github] - refactor: mention workflow author in slack (#8967) * [.github] - refactor: simplify retrieval of commit author information in slack-notify action - Use the GitHub actor as the commit author name and email instead of extracting from the git log - Set the author email to a no-reply GitHub address associated with the GitHub actor * [.github/.mailmap] - refactor: streamline mailmap and GitHub action for Slack notifications - Modified the GitHub action to look up the author email using the improved mailmap - Simplified the mailmap file to map GitHub usernames directly to their dust email addresses * [.mailmap] - refactor: clean up trailing whitespace - Remove the unnecessary empty line at the end of the .mailmap file --- .github/actions/slack-notify/action.yml | 21 ++++------- .mailmap | 50 ++++++++----------------- 2 files changed, 22 insertions(+), 49 deletions(-) diff --git a/.github/actions/slack-notify/action.yml b/.github/actions/slack-notify/action.yml index 33893dbf03a4..f17847131e5c 100644 --- a/.github/actions/slack-notify/action.yml +++ b/.github/actions/slack-notify/action.yml @@ -29,27 +29,20 @@ outputs: runs: using: "composite" steps: - - name: Get author email + - name: Get author info if: inputs.step == 'start' id: author shell: bash run: | - # Get last commit author name and email - AUTHOR_NAME=$(git log -1 --format='%an') - AUTHOR_EMAIL=$(git log -1 --format='%ae') + AUTHOR_NAME="${{ github.actor }}" - if ! CANONICAL=$(git check-mailmap "$AUTHOR_NAME <$AUTHOR_EMAIL>" 2>/dev/null); then - echo "email=$AUTHOR_EMAIL" >> $GITHUB_OUTPUT - echo "name=$AUTHOR_NAME" >> $GITHUB_OUTPUT - exit 0 + if ! EMAIL=$(git check-mailmap "$AUTHOR_NAME" 2>/dev/null); then + echo "GitHub handle $AUTHOR_NAME not found in mailmap" >&2 + exit 1 fi - # Extract email and name from canonical form - CANONICAL_EMAIL=$(echo "$CANONICAL" | grep -o '<.*>' | tr -d '<>') - CANONICAL_NAME=$(echo "$CANONICAL" | sed 's/ <.*>//') - - echo "email=$CANONICAL_EMAIL" >> $GITHUB_OUTPUT - echo "name=$CANONICAL_NAME" >> $GITHUB_OUTPUT + echo "email=$EMAIL" >> $GITHUB_OUTPUT + echo "name=$AUTHOR_NAME" >> $GITHUB_OUTPUT - name: Lookup by email if: inputs.step == 'start' diff --git a/.mailmap b/.mailmap index 29c0dcfdb38b..6f3fe7f373c8 100644 --- a/.mailmap +++ b/.mailmap @@ -1,35 +1,15 @@ -Alban Dumouilla -Alban Dumouilla -Alexandre Pinot -Alexandre Pinot <32997243+pinotalexandre@users.noreply.github.com> -Aubin Tchoi -Aubin Tchoi <60398825+aubin-tchoi@users.noreply.github.com> -Aubin Tchoi -Daphné Popin -Daphné Popin -Daphné Popin -Edouard Wautier -Edouard Wautier <4435185+Duncid@users.noreply.github.com> -Flavien David -Flavien David -Gabriel Hubert -Gabriel Hubert -Henry Fontanier -Henry Fontanier -Jules Belveze -Jules Belveze <32683010+JulesBelveze@users.noreply.github.com> -Jules Belveze -Lucas Massemin -Lucas Massemin -Pauline Pham -Pauline Pham <33726902+Yutcam@users.noreply.github.com> -Philippe Rolet -Philippe Rolet -Sebastien Flory -Sebastien Flory -Stanislas Polu -Stanislas Polu -Thibault Martin -Thibault Martin <168569391+thib-martin@users.noreply.github.com> -Thomas Draier -Thomas Draier +JulesBelveze jules@dust.tt +pinotalexandre alexandre@dust.tt +aubin-tchoi aubin@dust.tt +PopDaph daph@dust.tt +Duncid ed@dust.tt +flavien flavien@dust.tt +gabriel gabriel@dust.tt +henry henry@dust.tt +lucasmassemin lucas@dust.tt +Yutcam pauline@dust.tt +philipperolet pr@dust.tt +sflory seb@dust.tt +spolu spolu@dust.tt +thib-martin thibault@dust.tt +thomas thomas@dust.tt