From 196cd43937813dd7d1478e927e1e8862e8cfa55a Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 13 Feb 2026 12:33:01 -0500 Subject: [PATCH] add skip check --- .github/workflows/cla-workflow.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cla-workflow.yml b/.github/workflows/cla-workflow.yml index af1a047..d2a2491 100644 --- a/.github/workflows/cla-workflow.yml +++ b/.github/workflows/cla-workflow.yml @@ -51,33 +51,42 @@ jobs: exit 0 fi - echo "Committers on PR: $(echo $COMMITTERS | tr '\n' ' ')" + TOTAL=$(echo "$COMMITTERS" | wc -l) + echo "Committers on PR ($TOTAL): $(echo $COMMITTERS | tr '\n' ' ')" EXEMPT="" + EXEMPT_COUNT=0 # Non-fork PRs: all committers have push access if [[ "$HEAD" == "$BASE_REPO" ]]; then echo "Non-fork PR - all committers exempt from CLA" EXEMPT=$(echo "$COMMITTERS" | paste -sd,) + EXEMPT_COUNT=$TOTAL else # Fork PRs: check each committer's permission while IFS= read -r user; do [[ -z "$user" ]] && continue PERM=$(gh api "repos/$BASE_REPO/collaborators/$user/permission" --jq '.permission' 2>/dev/null || echo "none") if [[ "$PERM" == "admin" || "$PERM" == "maintain" || "$PERM" == "write" ]]; then - echo "$user: CLA not needed (exempt)" + echo "$user: exempt" EXEMPT="${EXEMPT:+$EXEMPT,}$user" + EXEMPT_COUNT=$((EXEMPT_COUNT + 1)) else echo "$user: CLA needed" fi done <<< "$COMMITTERS" fi + if [[ "$EXEMPT_COUNT" -eq "$TOTAL" ]]; then + echo "All committers exempt - CLA check not needed" + echo "cla-needed=false" >> $GITHUB_OUTPUT + else + echo "cla-needed=true" >> $GITHUB_OUTPUT + fi + if [[ -n "$EXEMPT" ]]; then - echo "Exempt users: $EXEMPT" echo "allowlist=$BASE_ALLOWLIST,$EXEMPT" >> $GITHUB_OUTPUT else - echo "No exempt users found" echo "allowlist=$BASE_ALLOWLIST" >> $GITHUB_OUTPUT fi env: @@ -89,9 +98,10 @@ jobs: - name: Generate GitHub App Token id: app-token if: >- - contains(github.event.comment.body, 'recheck') || + steps.check-perms.outputs.cla-needed != 'false' && + (contains(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' + github.event_name == 'pull_request_target') uses: actions/create-github-app-token@v1 with: app-id: ${{ secrets.CLA_APP_ID }} @@ -101,9 +111,10 @@ jobs: - name: "CLA Assistant" if: >- - contains(github.event.comment.body, 'recheck') || + steps.check-perms.outputs.cla-needed != 'false' && + (contains(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' + github.event_name == 'pull_request_target') uses: contributor-assistant/github-action@v2.6.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}