2222 - name : Build author-only allowlist
2323 id : allowlist
2424 if : >
25- github.event_name == 'pull_request_target' ||
25+ ( github.event_name == 'pull_request_target' && github.event.action != 'closed') ||
2626 (github.event_name == 'issue_comment' && github.event.issue.pull_request && (
2727 github.event.comment.body == 'recheck' ||
2828 github.event.comment.body == 'I have read and agree to the Contributor License Agreement'
@@ -35,20 +35,23 @@ jobs:
3535 # For each commit emit the GitHub login when the author/committer email resolves to a GitHub account
3636 # otherwise fall back to the raw git name.
3737 run : |
38- others=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/commits" --paginate \
39- --jq '.[] | (.author.login // .commit.author.name // empty), (.committer.login // .commit.committer.name // empty)' \
40- | sort -u | grep -vix "${PR_AUTHOR}" | paste -sd, -)
38+ if ! commit_authors=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/commits" --paginate \
39+ --jq '.[] | (.author.login // .commit.author.name // empty), (.committer.login // .commit.committer.name // empty)'); then
40+ echo "Failed to fetch pull request commits" >&2
41+ exit 1
42+ fi
43+ others=$(printf '%s\n' "$commit_authors" | sort -u | grep -vix "${PR_AUTHOR}" | paste -sd, -)
4144 if [ -n "$others" ]; then
4245 echo "allowlist=${BASE_ALLOWLIST},${others}" >> "$GITHUB_OUTPUT"
4346 else
4447 echo "allowlist=${BASE_ALLOWLIST}" >> "$GITHUB_OUTPUT"
4548 fi
4649
4750 - name : CLA Assistant
48- # Run on PR events, on "recheck" comment , or when someone posts the signing phrase.
51+ # Run on open/update PR events, on "recheck", or when someone posts the signing phrase.
4952 # IMPORTANT: this phrase must match `custom-pr-sign-comment` below.
5053 if : >
51- github.event_name == 'pull_request_target' ||
54+ ( github.event_name == 'pull_request_target' && github.event.action != 'closed') ||
5255 (github.event_name == 'issue_comment' && github.event.issue.pull_request && (
5356 github.event.comment.body == 'recheck' ||
5457 github.event.comment.body == 'I have read and agree to the Contributor License Agreement'
5962 # PAT required to write to the centralized signatures repo.
6063 PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
6164 with :
65+ lock-pullrequest-aftermerge : false
66+
6267 # Where the CLA document lives (shown to contributors)
6368 path-to-document : https://github.com/Comfy-Org/comfy-cla/blob/main/comfyui_icla.md
6469
9196
9297 custom-allsigned-prcomment : |
9398 ✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged.
99+
100+ - name : Lock PR containing a CLA signature or bot approval
101+ if : github.event_name == 'pull_request_target' && github.event.action == 'closed' && github.event.pull_request.merged == true
102+ uses : actions/github-script@v7
103+ with :
104+ retries : 3
105+ script : |
106+ const pr = context.payload.pull_request;
107+ const issue = { ...context.repo, issue_number: pr.number };
108+ const comments = await github.paginate(github.rest.issues.listComments, {
109+ ...issue,
110+ per_page: 100,
111+ });
112+ const signed = comments.some(comment =>
113+ (comment.user?.id === pr.user.id &&
114+ comment.body?.trim().toLowerCase() === 'i have read and agree to the contributor license agreement') ||
115+ (comment.user?.login === 'github-actions[bot]' &&
116+ comment.body?.startsWith('✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged.'))
117+ );
118+ if (signed) {
119+ await github.rest.issues.lock(issue);
120+ }
0 commit comments