48 lines · yaml
1name: "Check for private emails used in PRs"2 3on:4 pull_request:5 types:6 - opened7 8permissions:9 contents: read10 11jobs:12 validate_email:13 runs-on: ubuntu-24.0414 if: github.repository == 'llvm/llvm-project'15 steps:16 - name: Fetch LLVM sources17 uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.018 with:19 ref: ${{ github.event.pull_request.head.sha }}20 21 - name: Extract author email22 id: author23 run: |24 git log -125 echo "EMAIL=$(git show -s --format='%ae' HEAD~0)" >> $GITHUB_OUTPUT26 # Create empty comment file27 echo "[]" > comments28 29 - name: Validate author email30 if: ${{ endsWith(steps.author.outputs.EMAIL, 'noreply.github.com') }}31 env:32 COMMENT: >-33 ⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.<br/>34 Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account.<br/>35 See [LLVM Developer Policy](https://llvm.org/docs/DeveloperPolicy.html#email-addresses) and36 [LLVM Discourse](https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it) for more information.37 run: |38 cat << EOF > comments39 [{"body" : "$COMMENT"}]40 EOF41 42 - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.043 if: always()44 with:45 name: workflow-args46 path: |47 comments48