[llvm] [CI] Make email check workflow fail when author's email is private in Github UI (PR #148694)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 14 11:16:04 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-github-workflow
Author: Udit Kumar Agarwal (uditagarwal97)
<details>
<summary>Changes</summary>
**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`
---
Full diff: https://github.com/llvm/llvm-project/pull/148694.diff
1 Files Affected:
- (modified) .github/workflows/email-check.yaml (+7-1)
``````````diff
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:
``````````
</details>
https://github.com/llvm/llvm-project/pull/148694
More information about the llvm-commits
mailing list