Skip to content

Commit 08c6899

Browse files
Revert "[CI] Fix detecting usage of private emails" (#19488)
Reverts #19394 sadly. The workflow is failing if user's email is not listed publicly on your GH profile. This is different from not having your email public on Github (in Github email settings page vs. email field in Github profile/email settings). Reverting this PR till I figure out a fix.
1 parent 4f5d1e5 commit 08c6899

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

.github/workflows/email-check.yaml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,14 @@ jobs:
2121

2222
- name: Extract author email
2323
id: author
24-
env:
25-
GH_TOKEN: ${{ github.token }}
2624
run: |
27-
# Use Github GraphQL APIs to get the email associated with the PR author because this takes into account the GitHub settings for email privacy.
28-
query='
29-
query($login: String!) {
30-
user(login: $login) {
31-
email
32-
}
33-
}'
34-
35-
PR_AUTHOR=${{ github.event.pull_request.user.login }}
36-
37-
email=$(gh api graphql -f login="$PR_AUTHOR" -f query="$query" --jq '.data.user.email')
38-
echo "EMAIL_AUTHOR_GH_UI=$email" >> "$GITHUB_OUTPUT"
39-
25+
git log -1
26+
echo "EMAIL=$(git show -s --format='%ae' HEAD~0)" >> $GITHUB_OUTPUT
4027
# Create empty comment file
4128
echo "[]" > comments
4229
43-
# When EMAIL_AUTHOR_GH_UI is NULL, author's email is hidden in GitHub UI.
44-
# In this case, we warn the user to turn off "Keep my email addresses private"
45-
# setting in their account.
4630
- name: Validate author email
47-
if: ${{ steps.author.outputs.EMAIL_AUTHOR_GH_UI == '' }}
31+
if: ${{ endsWith(steps.author.outputs.EMAIL, 'noreply.github.com') }}
4832
env:
4933
COMMENT: >-
5034
⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.<br/>
@@ -55,9 +39,6 @@ jobs:
5539
[{"body" : "$COMMENT"}]
5640
EOF
5741
58-
# Fail this job.
59-
false
60-
6142
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
6243
if: always()
6344
with:

0 commit comments

Comments
 (0)