Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 15 additions & 23 deletions .github/workflows/cla-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,15 @@ jobs:
env:
PR_AUTHOR: ${{ github.event.pull_request.user.login }}

- name: Comment on PR
- name: Comment on PR (unsigned only)
if: steps.check.outputs.signed != 'true'
uses: actions/github-script@v7
with:
script: |
const signed = '${{ steps.check.outputs.signed }}' === 'true';
const author = '${{ github.event.pull_request.user.login }}';
const prNumber = ${{ github.event.pull_request.number }};

// Find existing CLA bot comment
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});

const botComment = comments.data.find(c =>
c.user.login === 'github-actions[bot]' &&
c.body.includes('CodeCoraDev CLA Bot')
);

const body = signed
? [
'## ✅ CodeCoraDev CLA Bot',
'',
`Thank you @${author}! Your CLA is on file. 🎉`,
'',
'Your contribution can now be reviewed.',
].join('\n')
: [
const body = [
'## ⚠️ CodeCoraDev CLA Bot',
'',
`Hi @${author}! Thanks for your contribution.`,
Expand All @@ -87,6 +67,18 @@ jobs:
'<sub>By signing, you agree to the terms in [CLA_INDIVIDUAL.md](https://github.com/codecoradev/.github/blob/main/CLA_INDIVIDUAL.md) or [CLA_CORPORATE.md](https://github.com/codecoradev/.github/blob/main/CLA_CORPORATE.md).</sub>',
].join('\n');

// Find existing CLA bot comment
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});

const botComment = comments.data.find(c =>
c.user.login === 'github-actions[bot]' &&
c.body.includes('CodeCoraDev CLA Bot')
);

if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
Expand Down
Loading