Testing CLA #106
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CLA Assistant" | |
on: | |
issue_comment: | |
types: [created] | |
pull_request_target: | |
types: [opened, closed, synchronize, labeled] # Added "labeled" event to check for label changes | |
workflow_dispatch: # Allow manual triggering of the workflow | |
permissions: | |
actions: write | |
contents: write | |
pull-requests: write | |
statuses: write | |
jobs: | |
CLAAssistant: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "CLA Assistant" | |
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/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_PAT }} | |
with: | |
path-to-signatures: 'signatures/version1/cla.json' | |
path-to-document: 'https://lmstudio.ai/opensource/cla' | |
remote-organization-name: lmstudio-ai | |
remote-repository-name: cla-signatures | |
branch: 'main' | |
allowlist: yagil,rugvedS07,ryan-the-crayon,azisislm | |
- name: "Label PR as CLA Signed" | |
if: success() # Ensure this step only runs if the previous step is successful | |
run: | | |
# Check if it's a pull request or issue comment event | |
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then | |
PR_NUMBER="${{ github.event.pull_request.number }}" | |
elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then | |
# Access PR number through issue object in case of comment event | |
PR_NUMBER="${{ github.event.issue.number }}" | |
fi | |
# Echo the PR number and endpoint to debug | |
ENDPOINT="https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels" | |
# Perform the curl request to label the PR if CLA signed by all contributors | |
curl -L -X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-d "{\"labels\":[\"CLA signed\"]}" \ | |
$ENDPOINT |