File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ name : " Check for private emails used in PRs"
2+
3+ on : pull_request_target
4+
5+ permissions :
6+ contents : read
7+
8+ jobs :
9+ validate_email :
10+ permissions :
11+ pull-requests : write
12+ runs-on : ubuntu-latest
13+ if : github.repository == 'llvm/llvm-project'
14+ steps :
15+ - name : Fetch LLVM sources
16+ uses : actions/checkout@v4
17+ with :
18+ ref : ${{ github.event.pull_request.head.sha }}
19+
20+ - name : Extract author email
21+ id : author
22+ run : |
23+ git log -1
24+ echo "EMAIL=$(git show -s --format='%ae' HEAD~0)" >> $GITHUB_OUTPUT
25+
26+ - name : Validate author email
27+ if : ${{ endsWith(steps.author.outputs.EMAIL, 'noreply.github.com') }}
28+ uses : actions/github-script@v6
29+ env :
30+ EMAIL : ${{ steps.author.outputs.EMAIL }}
31+ with :
32+ script : |
33+ const { EMAIL } = process.env
34+ await github.rest.issues.createComment({
35+ issue_number: context.issue.number,
36+ owner: context.repo.owner,
37+ repo: context.repo.repo,
38+ body: `⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
39+ Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account.
40+ `})
You can’t perform that action at this time.
0 commit comments