One self-hosted app for your shows, movies and music.
CLA: count an agreement made by email reply (#250)
CoderLuii7bd2f29847fd
diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.ymlindex 462f2d8..754fe35 100644--- a/.github/workflows/cla.yml+++ b/.github/workflows/cla.yml@@ -112,13 +112,15 @@ jobs:// when runs overlap or a later comment arrives first.const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number: number, per_page: 100 });const clean = (s) => s.trim().replace(/[.!\s]+$/, '').toLowerCase();+ // Email replies quote the whole thread under the agreement, so the first line counts.+ const firstLine = (s) => (s ?? '').trim().split(/\r?\n/)[0];const CLA_VERSION = '1.0';const claSha = (await github.rest.repos.getContent({ owner, repo, path: '.github/CLA.md', ref: pr.base.repo.default_branch })).data.sha;const fresh = [];for (const c of comments) {- if (c.user && people.has(c.user.id) && !signed(c.user.id) && !fresh.some((f) => f.id === c.user.id) && clean(c.body ?? '') === clean(SENTENCE)) {+ if (c.user && people.has(c.user.id) && !signed(c.user.id) && !fresh.some((f) => f.id === c.user.id) && clean(firstLine(c.body)) === clean(SENTENCE)) {fresh.push({ id: c.user.id, login: c.user.login, pull_request: number, comment: c.html_url, comment_id: c.id,- text: c.body.trim(), signed_at: c.updated_at || c.created_at, cla_version: CLA_VERSION, cla_sha: claSha });+ text: firstLine(c.body), signed_at: c.updated_at || c.created_at, cla_version: CLA_VERSION, cla_sha: claSha });}}