[llvm] [CI] Make email check workflow fail when author's email is private in Github UI (PR #148694)
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 15 02:07:03 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.
+ 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"
----------------
DavidSpickett wrote:
I assume this will be removed before merging. In theory it's already public information but once this is working no need to print it more than we have to.
https://github.com/llvm/llvm-project/pull/148694
More information about the llvm-commits
mailing list