-
Notifications
You must be signed in to change notification settings - Fork 9
56 lines (48 loc) · 1.66 KB
/
Copy pathcla-check.yml
File metadata and controls
56 lines (48 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: CLA Check
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
- ready_for_review
jobs:
cla:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Verify contributor CLA signature
env:
CLA_CHECK_SECRET: ${{ secrets.CLA_CHECK_SECRET }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
node -e "
(async () => {
const author = process.env.PR_AUTHOR;
const secret = process.env.CLA_CHECK_SECRET;
if (!author) throw new Error('Missing PR author.');
if (!secret) throw new Error('Missing CLA_CHECK_SECRET.');
console.log('Checking CLA signature for @' + author + '...');
const response = await fetch('https://codra.run/api/internal/check-cla?user=' + encodeURIComponent(author), {
headers: {
'x-cla-check-secret': secret,
},
});
if (!response.ok) {
const body = await response.text();
throw new Error('API Error ' + response.status + ': ' + body);
}
const payload = await response.json();
if (!payload.signed) {
console.error('❌ @' + author + ' has not signed the CLA.');
console.error('Please visit https://codra.run/cla to sign.');
process.exit(1);
}
console.log('✅ CLA confirmed for @' + author + '.');
})().catch(err => {
console.error(err.message);
process.exit(1);
});
"