|
| 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