Skip to content

Commit 9e5922b

Browse files
authored
MATTER-5525: Implement Shared CLA Action (#35)
* implement shared cla action * remove pull_request check
1 parent 83a4738 commit 9e5922b

File tree

2 files changed

+79
-33
lines changed

2 files changed

+79
-33
lines changed
Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CLA validation
1+
name: CLA Validation
22

33
on:
44
issue_comment:
@@ -8,39 +8,13 @@ on:
88

99
permissions:
1010
actions: write
11-
contents: read
11+
contents: read
1212
pull-requests: write
1313
statuses: write
14-
14+
1515
jobs:
1616
CLAAssistant:
17-
runs-on: ubuntu-latest
18-
if: ${{ github.actor != 'dependabot[bot]' }}
19-
steps:
20-
- name: Create CLA Assistant Lite bot token
21-
uses: actions/create-github-app-token@v2
22-
id: app-token
23-
with:
24-
app-id: ${{ secrets.SILABSIN_CLA_BOT_APP_ID }}
25-
private-key: ${{ secrets.SILABSIN_CLA_BOT_APP_PRIVATE_KEY }}
26-
owner: SiliconLabsInternal
27-
repositories: contributor-license-agreements
28-
29-
- name: Mask generated token
30-
run: echo "::add-mask::${{ steps.app-token.outputs.token }}"
31-
32-
- name: "CLA Assistant"
33-
if: ${{ contains(github.event.comment.body, 'I have read the CLA Document and I hereby sign the CLA') }} || github.event_name == 'pull_request_target'
34-
uses: SiliconLabsSoftware/action-cla-assistant@silabs_flavour_v2
35-
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
PERSONAL_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }}
38-
with:
39-
path-to-signatures: "cla_signatures_db.json"
40-
path-to-document: "https://github.com/SiliconLabsSoftware/agreements-and-guidelines/blob/main/contributor_license_agreement.md"
41-
branch: 'cla-database'
42-
allowlist: silabs-*,bot*
43-
remote-organization-name: "SiliconLabsInternal"
44-
remote-repository-name: "contributor-license-agreements"
45-
create-file-commit-message: "Created the CLA database file. CLA Assistant Lite bot created this file."
46-
signed-commit-message: "$contributorName has signed the CLA in $owner/$repo#$pullRequestNo"
17+
uses: ./.github/workflows/cla.yml
18+
secrets:
19+
CLA_APP_ID: ${{ secrets.SILABSIN_CLA_BOT_APP_ID }}
20+
CLA_APP_PRIVATE_KEY: ${{ secrets.SILABSIN_CLA_BOT_APP_PRIVATE_KEY }}

.github/workflows/cla.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Reusable CLA validation
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
remote_org:
7+
type: string
8+
default: "SiliconLabsInternal"
9+
remote_repo:
10+
type: string
11+
default: "contributor-license-agreements"
12+
signatures_path:
13+
type: string
14+
default: "cla_signatures_db.json"
15+
document_url:
16+
type: string
17+
default: "https://github.com/SiliconLabsSoftware/agreements-and-guidelines/blob/main/contributor_license_agreement.md"
18+
allowlist:
19+
type: string
20+
default: silabs-*,bot*
21+
branch:
22+
type: string
23+
default: "cla-database"
24+
runner:
25+
type: string
26+
default: "ubuntu-latest"
27+
secrets:
28+
CLA_APP_ID:
29+
required: true
30+
CLA_APP_PRIVATE_KEY:
31+
required: true
32+
33+
permissions:
34+
actions: write
35+
contents: read
36+
pull-requests: write
37+
statuses: write
38+
39+
jobs:
40+
cla:
41+
runs-on: ${{ inputs.runner }}
42+
if: |
43+
github.event.pull_request.user.login != 'dependabot[bot]' &&
44+
github.event.pull_request.user.login != 'silabs-matter-ci-bot'
45+
steps:
46+
- name: Create CLA Assistant Lite bot token
47+
id: app-token
48+
uses: actions/create-github-app-token@v2
49+
with:
50+
app-id: ${{ secrets.CLA_APP_ID }}
51+
private-key: ${{ secrets.CLA_APP_PRIVATE_KEY }}
52+
owner: ${{ inputs.remote_org }}
53+
repositories: ${{ inputs.remote_repo }}
54+
55+
- name: Mask generated token
56+
run: echo "::add-mask::${{ steps.app-token.outputs.token }}"
57+
58+
- name: CLA Assistant
59+
if: ${{ (contains(github.event.comment.body, 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' }}
60+
uses: SiliconLabsSoftware/action-cla-assistant@silabs_flavour_v2
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
PERSONAL_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }}
64+
with:
65+
path-to-signatures: ${{ inputs.signatures_path }}
66+
path-to-document: ${{ inputs.document_url }}
67+
branch: ${{ inputs.branch }}
68+
allowlist: ${{ inputs.allowlist }}
69+
remote-organization-name: ${{ inputs.remote_org }}
70+
remote-repository-name: ${{ inputs.remote_repo }}
71+
create-file-commit-message: "Created the CLA database file. CLA Assistant Lite bot created this file."
72+
signed-commit-message: "$contributorName has signed the CLA in $owner/$repo#$pullRequestNo"

0 commit comments

Comments
 (0)