# SPDX-FileCopyrightText: <%= year %> <%= copyrightHolder %>
# SPDX-License-Identifier: MIT

name: "Contributor License Agreement"
on:
  issue_comment:
    types: [created]
  pull_request_target:
    types: [opened,closed,synchronize]

concurrency:  
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  actions: write
  contents: write
  pull-requests: write
  statuses: write

jobs:
  require-contributor-license-agreement:
    name: "Contributor License Agreement"
    runs-on: ubuntu-latest
    steps:
      - name: "Require Contributor License Agreement"
        if: (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@v2.6.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          path-to-signatures: 'signatures/version1/cla.json'
          create-file-commit-message: 'Creating file for storing CLA Signatures'
          signed-commit-message: '$contributorName has signed the CLA in $owner/$repo#$pullRequestNo'
          path-to-document: '<%= repositoryUrl %>/blob/main/.github/CLA.md'
          branch: 'chore/cla-signatures'
          # The below is the list of users who are allowed to sign the CLA without any check
          allowlist: 'renovatebot,dependabot'
