-
Notifications
You must be signed in to change notification settings - Fork 1.8k
67 lines (67 loc) · 3.2 KB
/
cla-assistant.yaml
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
name: "CLA Assistant"
on:
issue_comment:
types:
- created # PR comments are considered issue_comments
pull_request_target:
types:
- opened
- synchronize # Run on any diff changes to the PR (e.g. code updates)
# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
permissions:
actions: read
contents: read # this can be 'read' if the signatures are in remote repository
pull-requests: write
jobs:
cla-assistant:
# Only do job for pull requests. For issues this is skipped making workflow a no-op
if: ${{ github.event_name == 'pull_request_target' || github.event.issue.pull_request }} # triggers on pr updates and coments
name: "Check Contributor License Agreement Signed"
runs-on: ubuntu-latest
steps:
- name: Fetch installation token
id: fetch-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.CLA_ASSISTANT_APP_ID }}
private-key: ${{ secrets.CLA_ASSISTANT_APP_PRIVATE_KEY }}
repositories: cla-signatures
- name: "Determine gravitational membership"
id: get-membership
env:
GITHUB_TOKEN: ${{ steps.fetch-token.outputs.token }}
USER: ${{ github.actor }}
continue-on-error: true
# Use the "Check Membership" API for user
# If the user is a member of the org expect a 204 HTTP Status Code
# If the above is success the process will exit 0
run: |
gh api "orgs/gravitational/members/${USER}" > /dev/null
# This step runs the CLA Assistant GHA
# If the creator of the PR is someone in the 'gravitational' org this step is skipped
# Otherwise for those out of the gravitational org:
# * CLA Assistant gathers authors from commits made to the PR
# * Will determine if authors have already signed the CLA
#
# To sign the CLA a user can reply to the PR with the comment:
# * 'I have read the CLA Document and I hereby sign the CLA'
#
# The workflow will be rerun again to perform a recheck on:
# * Any code changes to the PR
# * PR comment with the body being 'recheck' - In the event of a transient failure
# * PR comment with body 'I have read the CLA Document and I hereby sign the CLA'
- name: "CLA Assistant"
if: steps.get-membership.outcome != 'success' && ((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')
uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ steps.fetch-token.outputs.token }}
with:
remote-organization-name: gravitational
remote-repository-name: cla-signatures
path-to-signatures: 'version1_signatures.json'
path-to-document: 'https://github.com/gravitational/teleport/blob/master/CLA.md'
# branch should not be protected
branch: 'main'
allowlist: '*[bot]'
lock-pullrequest-aftermerge: false