Skip to content

Commit 81ecd9f

Browse files
committed
CI: Add CLA workflow, triggered on prs and issue comments
1 parent 6849516 commit 81ecd9f

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/cla.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "CLA Assistant"
2+
3+
# The CLA assistant workflow must have write scope for pull request comments, and so must be ran on pull_request_target, and issue comments.
4+
on:
5+
issue_comment:
6+
types: [created]
7+
pull_request_target:
8+
types: [opened,closed,synchronize]
9+
10+
# Explicit permissions
11+
permissions:
12+
actions: write
13+
contents: read
14+
pull-requests: write
15+
statuses: write
16+
17+
jobs:
18+
CLAAssistant:
19+
# Only run the job at all for pull_request_targets or comments which contain one of two strings.
20+
# Contains is used to allow whitespace in the comment which is checked in an inner step.
21+
if: github.event_name == 'pull_request_target' || (contains(github.event.comment.body, 'recheck') || contains(github.event.comment.body, 'I have read the CLA Document and I hereby sign the CLA'))
22+
runs-on: ubuntu-latest
23+
steps:
24+
# If triggered by an issue comment, compare a trimmed version to allow for additional whitespace.
25+
# Uses JS to avoid having to do shell character escaping nicely
26+
- name: "Check comment"
27+
id: check_trimmed_comment
28+
if: github.event_name == 'issue_comment'
29+
uses: actions/github-script@v8
30+
with:
31+
script: |
32+
const comment = context.payload.comment.body;
33+
const trimmed = comment.trim();
34+
if (trimmed === 'recheck' || trimmed === 'I have read the CLA Document and I hereby sign the CLA') {
35+
return 'true';
36+
} else {
37+
return 'false';
38+
}
39+
result-encoding: string
40+
41+
# For pull_request_triggers, or comments which contained (whitespace wrapped) trigger phrases, run the contributor assistant
42+
- name: "Contributor Assistant"
43+
if: github.event_name == 'pull_request_target' || steps.check_trimmed_comment.outputs.result == 'true'
44+
uses: FLAMEGPU/contributor-assistant-github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_SIGNATURES_PAT }}
48+
with:
49+
path-to-signatures: 'signatures/v1/cla.json'
50+
path-to-document: 'https://flamegpu.com/download/cla/'
51+
branch: 'main'
52+
# allowlist: bot*
53+
remote-organization-name: FLAMEGPU
54+
remote-repository-name: cla-signatures
55+
lock-pullrequest-aftermerge: false

0 commit comments

Comments
 (0)