[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
Tue Jul 15 10:54:48 PDT 2025


================
@@ -20,14 +21,33 @@ jobs:
 
       - name: Extract author email
         id: author
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
-          git log -1
-          echo "EMAIL=$(git show -s --format='%ae' HEAD~0)" >> $GITHUB_OUTPUT
+          # Use Github GraphQL APIs to get the email associated with the PR author because this takes into account the GitHub settings for email privacy.
+          query='
+          query($login: String!) {
+            user(login: $login) {
+              email
+            }
+          }'
+
+          PR_AUTHOR=${{ github.event.pull_request.user.login }}
+
+          email=$(gh api graphql -f login="$PR_AUTHOR" -f query="$query" -H "Authorization: Bearer $GITHUB_TOKEN" --jq '.data.user.email')
+          echo "EMAIL_AUTHOR_GH_UI=$email" >> "$GITHUB_OUTPUT"
+
+          # Print the email to the log for debugging purposes.
+          echo "GitHub user's email: $email"
----------------
uditagarwal97 wrote:

```suggestion
```

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


More information about the llvm-commits mailing list