[llvm] [CI] Make email check workflow fail when author's email is private in Github UI (PR #148694)
Udit Kumar Agarwal via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 14 11:15:34 PDT 2025
https://github.com/uditagarwal97 created https://github.com/llvm/llvm-project/pull/148694
**Problem**
Consider the following case:
Someone creates a PR with the signed commit but has email set to "private" in the Github UI (https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/blocking-command-line-pushes-that-expose-your-personal-email-address). Currently, the email check workflow checkout to the branch and use `git show -s --format='%ae' HEAD~0` to see email used for the last commit and the workflow will pass. However, when merging this PR, since the email is setting is private in Github UI, the merged PR will be authored with `@noreply.github.com`.
We saw several such cases in our fork of llvm. See https://github.com/intel/llvm/issues/17675
**Solution**
This PR also checks for `github.event.pull_request.user.email` if it's NULL or not. If NULL, the PR will be merged with `@noreply.github.com`
>From 857291f5191c97a7889becc29c3a16e665f96424 Mon Sep 17 00:00:00 2001
From: "Agarwal, Udit" <udit.agarwal at intel.com>
Date: Thu, 10 Jul 2025 21:10:36 +0200
Subject: [PATCH] Fix workflow
Signed-off-by: Agarwal, Udit <udit.agarwal at intel.com>
---
.github/workflows/email-check.yaml | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/email-check.yaml b/.github/workflows/email-check.yaml
index 904ad718f97dd..35cbcd3c810eb 100644
--- a/.github/workflows/email-check.yaml
+++ b/.github/workflows/email-check.yaml
@@ -26,8 +26,11 @@ jobs:
# Create empty comment file
echo "[]" > comments
+ # If author's email is hidden in GH's settings, github.event.pull_request.user.email
+ # will be null and PR will be authored by noreply.github.com.
- name: Validate author email
- if: ${{ endsWith(steps.author.outputs.EMAIL, 'noreply.github.com') }}
+ if: endsWith(steps.author.outputs.EMAIL, 'noreply.github.com') ||
+ github.event.pull_request.user.email == ''
env:
COMMENT: >-
⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.<br/>
@@ -39,6 +42,9 @@ jobs:
[{"body" : "$COMMENT"}]
EOF
+ # Fail this job.
+ false
+
- uses: actions/upload-artifact at 26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
if: always()
with:
More information about the llvm-commits
mailing list