[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:43:16 PDT 2025


https://github.com/uditagarwal97 updated https://github.com/llvm/llvm-project/pull/148694

>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 1/5] 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:

>From 5aaf23af32d09fc268e3d304e385433e5ddc595a Mon Sep 17 00:00:00 2001
From: "Agarwal, Udit" <udit.agarwal at intel.com>
Date: Mon, 14 Jul 2025 20:31:51 +0200
Subject: [PATCH 2/5] add debug

---
 .github/workflows/email-check.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.github/workflows/email-check.yaml b/.github/workflows/email-check.yaml
index 35cbcd3c810eb..1fc50a904ec32 100644
--- a/.github/workflows/email-check.yaml
+++ b/.github/workflows/email-check.yaml
@@ -42,6 +42,9 @@ jobs:
           [{"body" : "$COMMENT"}]
           EOF
 
+          echo steps.author.outputs.EMAIL
+          echo "$(github.event.pull_request.user.email)"
+
           # Fail this job.
           false
 

>From ab60985699986c2a423a8dbff472153003f6b269 Mon Sep 17 00:00:00 2001
From: "Agarwal, Udit" <udit.agarwal at intel.com>
Date: Mon, 14 Jul 2025 20:35:18 +0200
Subject: [PATCH 3/5] add edited trigger

---
 .github/workflows/email-check.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/email-check.yaml b/.github/workflows/email-check.yaml
index 1fc50a904ec32..69363773c0bc0 100644
--- a/.github/workflows/email-check.yaml
+++ b/.github/workflows/email-check.yaml
@@ -4,6 +4,7 @@ on:
   pull_request:
     types:
       - opened
+      - edited
 
 permissions:
   contents: read

>From 0deca03582c7b5b6bd31f939284debe28c68476f Mon Sep 17 00:00:00 2001
From: "Agarwal, Udit" <udit.agarwal at intel.com>
Date: Mon, 14 Jul 2025 20:39:43 +0200
Subject: [PATCH 4/5] fix trigger

---
 .github/workflows/email-check.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/email-check.yaml b/.github/workflows/email-check.yaml
index 69363773c0bc0..658d922c6c3a8 100644
--- a/.github/workflows/email-check.yaml
+++ b/.github/workflows/email-check.yaml
@@ -4,7 +4,7 @@ on:
   pull_request:
     types:
       - opened
-      - edited
+      - synchronize
 
 permissions:
   contents: read

>From 4cc11b53629235dca9acdb5cbfa227663275f6bd Mon Sep 17 00:00:00 2001
From: "Agarwal, Udit" <udit.agarwal at intel.com>
Date: Mon, 14 Jul 2025 20:43:02 +0200
Subject: [PATCH 5/5] fix debug log

---
 .github/workflows/email-check.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/email-check.yaml b/.github/workflows/email-check.yaml
index 658d922c6c3a8..6bb00ea232a32 100644
--- a/.github/workflows/email-check.yaml
+++ b/.github/workflows/email-check.yaml
@@ -43,8 +43,9 @@ jobs:
           [{"body" : "$COMMENT"}]
           EOF
 
-          echo steps.author.outputs.EMAIL
-          echo "$(github.event.pull_request.user.email)"
+          # Print the email to the log for debugging purposes.
+          echo "Author's email: ${steps.author.outputs.EMAIL}"
+          echo "GitHub user's email: ${github.event.pull_request.user.email}"
 
           # Fail this job.
           false



More information about the llvm-commits mailing list