Skip to content

One self-hosted app for your shows, movies and music.

CLA: a skipped bot-comment run never pushes out a real one (#255)

CoderLuii955c54599ca1
diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml
index 93a5aef..84a7dcc 100644
--- a/.github/workflows/cla.yml
+++ b/.github/workflows/cla.yml
@@ -11,7 +11,7 @@ on:
pull_request_target:
types: [opened, reopened, synchronize]
issue_comment:
- types: [created]
+ types: [created, edited]
# Run it by hand for a pull request opened before this check existed.
workflow_dispatch:
inputs:
@@ -23,8 +23,13 @@ on:
permissions:
contents: read
+# Comments the job skips get a queue of their own: a newly queued run replaces
+# a waiting one in the same group, and a skipped run must never replace a real one.
concurrency:
- group: cla-${{ github.event.pull_request.number || github.event.issue.number || inputs.pull_request }}
+ group: >-
+ ${{ github.event_name == 'issue_comment' && (!github.event.issue.pull_request || github.event.comment.user.type == 'Bot')
+ && format('cla-skip-{0}', github.run_id)
+ || format('cla-{0}', github.event.pull_request.number || github.event.issue.number || inputs.pull_request) }}
cancel-in-progress: false
jobs:
@@ -113,7 +118,8 @@ jobs:
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];
+ // Quoted lines (Quote reply) and code fences around the line are skipped.
+ const firstLine = (s) => (s ?? '').split(/\r?\n/).map((l) => l.trim()).find((l) => l && !l.startsWith('>') && !l.startsWith('```')) ?? '';
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 = [];