name: CLA Assistant
on:
  issue_comment:
    types: [created]
  pull_request_target:
    types: [opened, closed, synchronize]

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

jobs:
  cla:
    runs-on: ubuntu-latest
    steps:
      - name: CLA Assistant
        if: (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 }}
          PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
        with:
          path-to-signatures: 'signatures.json'
          path-to-document: 'https://github.com/Aryan-Raj3112/episteme/blob/main/CLA.md'
          branch: 'cla-signatures'
          allowlist: 'bot*,dependabot*'

          # Custom messages
          custom-notsigned-prcomment: |
            Thank you for your contribution! Before we can merge this, you need to sign our 
            [Contributor License Agreement](https://github.com/Aryan-Raj3112/episteme/blob/main/CLA.md).
            
            **Why?** Episteme is dual-licensed (open-source AGPL + commercial). The CLA ensures 
            we have permission to use your contribution in both versions.
            
            To sign, please reply with a comment containing exactly:
            ```
            I have read the CLA Document and I hereby sign the CLA
            ```
            
            You only need to do this once. It covers all future contributions.

          custom-pr-sign-comment: 'I have read the CLA Document and I hereby sign the CLA'
          custom-allsigned-prcomment: 'All contributors have signed the CLA. ✅'