Skip to content

Commit 9c9456e

Browse files
authored
Merge branch 'stable' into feature/exclude-proxy-config
2 parents f88c316 + 076b175 commit 9c9456e

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/cla.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: "CLA Assistant"
2+
on:
3+
issue_comment:
4+
types: [created]
5+
pull_request_target:
6+
types: [opened, closed, synchronize]
7+
8+
permissions:
9+
actions: write
10+
contents: write
11+
pull-requests: write
12+
statuses: write
13+
14+
jobs:
15+
CLAAssistant:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Generate token from GitHub App
19+
id: app-token
20+
uses: actions/create-github-app-token@v1
21+
with:
22+
app-id: ${{ secrets.APP_ID }}
23+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
24+
owner: blacklanternsecurity
25+
26+
- name: Check org membership
27+
id: membership
28+
env:
29+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
30+
run: |
31+
if [ "${{ github.event_name }}" = "pull_request_target" ]; then
32+
AUTHOR="${{ github.event.pull_request.user.login }}"
33+
else
34+
PR_NUM="${{ github.event.issue.number }}"
35+
AUTHOR=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUM" --jq '.user.login' 2>/dev/null)
36+
fi
37+
if [ -n "$AUTHOR" ] && gh api "orgs/blacklanternsecurity/members/$AUTHOR" > /dev/null 2>&1; then
38+
echo "is_member=true" >> "$GITHUB_OUTPUT"
39+
else
40+
echo "is_member=false" >> "$GITHUB_OUTPUT"
41+
fi
42+
43+
- name: Skip CLA for org members
44+
if: steps.membership.outputs.is_member == 'true' && github.event_name == 'pull_request_target'
45+
env:
46+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
gh api --method POST "repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }}" \
49+
-f state=success \
50+
-f context="CLAAssistant" \
51+
-f description="CLA check skipped — author is an org member"
52+
53+
- name: "CLA Assistant"
54+
if: |
55+
(steps.membership.outputs.is_member != 'true') &&
56+
((github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target')
57+
uses: contributor-assistant/github-action@v2.6.1
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
PERSONAL_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }}
61+
with:
62+
path-to-signatures: "signatures/version1/cla.json"
63+
path-to-document: "https://github.com/blacklanternsecurity/CLA/blob/main/ICLA.md"
64+
branch: "main"
65+
allowlist: "dependabot[bot],github-actions[bot],renovate[bot]"
66+
remote-organization-name: "blacklanternsecurity"
67+
remote-repository-name: "CLA"

0 commit comments

Comments
 (0)