Repository navigation
144 lines (144 loc) · 6.65 KB
/
Copy pathcla.yml
File metadata and controls
144 lines (144 loc) · 6.65 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
name: CLA Assistant
permissions: {}
on:
issue_comment: # zizmor: ignore[dangerous-triggers] CLA Assistant reads sign comments; no PR code is checked out
types:
- created
pull_request_target: # zizmor: ignore[dangerous-triggers] CLA Assistant needs write access on fork PRs; no PR code is checked out
types:
- opened
- closed
- synchronize
- labeled
jobs:
CLAAssistant:
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
pull-requests: write
statuses: write
checks: write
issues: write
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@46b06cea07f9e64621fdf066ba77ac6915163d43 # v2.22.3
with:
egress-policy: audit
- name: Checkout Private Repo for Allowlist
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: OpenZeppelin/cla-sigs
token: ${{ secrets.CLA_SIGS_ACCESS_PAT }}
sparse-checkout: |
allowlist.txt
sparse-checkout-cone-mode: false
- name: Read Allowlist File
id: read_allowlist
run: |
ALLOWLIST=$(cat allowlist.txt)
echo "allowlist=$ALLOWLIST" >> $GITHUB_OUTPUT
- name: Check if user is in allowlist
id: check_allowlist
env:
PR_USER: ${{ github.event.pull_request.user.login }}
ALLOWLIST: ${{ steps.read_allowlist.outputs.allowlist }}
run: |
if [[ "$ALLOWLIST" == *"$PR_USER"* ]]; then
echo "is_allowed=true" >> $GITHUB_OUTPUT
else
echo "is_allowed=false" >> $GITHUB_OUTPUT
fi
- name: CLA Assistant
continue-on-error: true
id: cla_assistant
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I confirm that I have read and hereby agree to the OpenZeppelin Contributor License Agreement') || github.event_name == 'pull_request_target'
uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_SIGS_ACCESS_PAT }}
with:
path-to-signatures: signatures/${{ github.event.repository.name }}/v1_cla.json
path-to-document: https://github.com/OpenZeppelin/cla-assistant/blob/main/openzeppelin_2025_cla.md
branch: main
allowlist: ${{ steps.read_allowlist.outputs.allowlist }}
remote-organization-name: OpenZeppelin
remote-repository-name: cla-sigs
custom-notsigned-prcomment: >
Thank you for your contribution to ${{ github.event.repository.name }}. Before being able to integrate those changes, we would like you to sign our [Contributor License Agreement](https://github.com/OpenZeppelin/cla-assistant/blob/main/openzeppelin_2025_cla.md).
You can sign the CLA by just posting a Pull Request Comment with the sentence below. Thanks.
custom-pr-sign-comment: I confirm that I have read and hereby agree to the OpenZeppelin Contributor License Agreement
- name: Label PR as CLA Unsigned
if: ${{ steps.cla_assistant.outcome != 'success' && steps.check_allowlist.outputs.is_allowed == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then
PR_NUMBER="${{ github.event.issue.number }}"
fi
ENDPOINT="https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels"
curl -L -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d '{"labels":["cla: unsigned"]}' \
$ENDPOINT
exit 1
- name: Label PR as CLA Signed
if: ${{ steps.cla_assistant.outcome == 'success' && steps.check_allowlist.outputs.is_allowed == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then
PR_NUMBER="${{ github.event.issue.number }}"
fi
ENDPOINT="https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels"
# Remove 'cla: unsigned' label if present
curl -L -X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"$ENDPOINT/cla:%20unsigned" || true
# Add 'cla: signed' label
curl -L -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d '{"labels":["cla: signed"]}' \
$ENDPOINT
- name: Label PR as CLA Allowlist
if: ${{ steps.check_allowlist.outputs.is_allowed == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then
PR_NUMBER="${{ github.event.issue.number }}"
fi
ENDPOINT="https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels"
# Remove 'cla: unsigned' label if present
curl -L -X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"$ENDPOINT/cla:%20unsigned" || true
# Remove 'cla: signed' label if present
curl -L -X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"$ENDPOINT/cla:%20signed" || true
# Add allowlist label
curl -L -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d '{"labels":["cla: allowlist"]}' \
$ENDPOINT