One self-hosted app for your shows, movies and music.
CLA check: audit fixes (#228)
CoderLuii66883f5022b2
diff --git a/.github/CLA.md b/.github/CLA.mdindex ce835b2..4309bdf 100644--- a/.github/CLA.md+++ b/.github/CLA.md@@ -41,8 +41,8 @@ You accept and agree to the following terms and conditions for Your present and## How to agree-On your first pull request, a bot posts a comment. Reply with exactly:+On your first pull request, HolyArrs Bot posts a comment. Add a comment (a normal comment, not a review) with this line:I have read the CLA and I agree to it.-The bot records your GitHub name, the date and the pull request. You only do this once. If you contribute for a company, ask us first; your employer may need to agree too (Section 5).+HolyArrs Bot records your GitHub name and account number, the pull request, a link to your comment and its words, the date, and which version of this agreement you agreed to. They are kept on the `cla-signatures` branch of this repository. You only do this once. To have your entry changed, write to [email protected]. If you contribute for a company, ask us first; your employer may need to agree too (Section 5).diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.ymlindex bf99d09..462f2d8 100644--- a/.github/workflows/cla.yml+++ b/.github/workflows/cla.yml@@ -29,7 +29,7 @@ concurrency:jobs:cla:- name: CLA+ name: CLA bot runruns-on: ubuntu-latest# Comments on issues and the bot's own comments start nothing.if: >-@@ -74,6 +74,8 @@ jobs:// Everyone who wrote a commit here must agree, not only the opener.// Accounts are tracked by id, so a renamed account keeps its agreement.+ // Commit authorship comes from email addresses, which anyone can set;+ // the opener always has to agree, so that is where trust rests.if (pr.commits > 250) {await status('failure', 'Too many commits to check; please split this pull request');return;@@ -95,7 +97,9 @@ jobs:const readFile = async () => {try {const f = (await github.rest.repos.getContent({ owner, repo, path: FILE, ref: BRANCH })).data;- return { list: JSON.parse(Buffer.from(f.content, 'base64').toString('utf8')), fileSha: f.sha };+ const list = JSON.parse(Buffer.from(f.content, 'base64').toString('utf8'));+ if (!Array.isArray(list)) throw new Error('signatures.json is not a list');+ return { list, fileSha: f.sha };} catch (e) {if (e.status === 404) return { list: [], fileSha: undefined };throw e;@@ -108,10 +112,13 @@ 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();+ 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)) {- fresh.push({ id: c.user.id, login: c.user.login, pull_request: number, comment: c.html_url, signed_at: c.created_at, comment_id: c.id });+ 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 });}}@@ -133,7 +140,7 @@ jobs:// Two pull requests may write at once: re-read and retry.for (let attempt = 1; ; attempt++) {const now = await readFile();- const toSave = fresh.filter((f) => !now.list.some((s) => s.id === f.id)).map(({ comment_id, ...s }) => s);+ const toSave = fresh.filter((f) => !now.list.some((s) => s.id === f.id));if (!toSave.length) { signatures = now.list; break; }const next = [...now.list, ...toSave];try {@@ -174,16 +181,22 @@ jobs:const unlinkedMark = `<!-- holyarrs-cla-unlinked:${unlinked.join(',')} -->`;const tellUnlinked = unlinked.length && !mine.some((c) => c.body.includes(unlinkedMark));if (!toAsk.length && !tellUnlinked) return;- const named = toAsk.slice(0, 10);+ const opener = toAsk.find(([id]) => id === pr.user.id);+ const others = toAsk.filter(([id]) => id !== pr.user.id).slice(0, 10);+ const named = [...(opener ? [opener] : []), ...others];+ const who = [...(opener ? ['@' + opener[1]] : []), ...others.map(([, l]) => '`' + l + '`')].join(', ');const parts = [`${named.map(([id]) => askMark(id)).join('')}${tellUnlinked ? unlinkedMark : ''}`];if (named.length) {parts.push(- `π Hey ${named.map(([, l]) => '@' + l).join(' ')}, thanks for this pull request! I'm HolyArrs Bot, here for one quick thing before it can be merged.`,+ `π Hey ${who}, thanks for this pull request! I'm HolyArrs Bot, here for one quick thing before it can be merged.`,`π Please read the HolyArrs [contributor licence agreement](${doc}). In short: you keep the copyright to your work, HolyArrs can be offered under the AGPL and a commercial licence, and anything merged always stays available under the AGPL.`,- `βοΈ If you agree, reply to this pull request with this line. You only ever do this once:`,+ `βοΈ If you agree, add a comment to this pull request (a normal comment, not a review) with this line. You only ever do this once:`,'```\n' + SENTENCE + '\n```');}+ if (others.length) {+ parts.push(`π€ ${others.map(([, l]) => '`' + l + '`').join(', ')} also wrote commits here and ${others.length === 1 ? 'needs' : 'need'} to add the line too. @${pr.user.login}, could you let them know?`);+ }if (tellUnlinked) {parts.push(`π These commits use an email that isn't linked to a GitHub account, so I can't tell who wrote them: ${unlinked.map((s) => '`' + s + '`').join(', ')}. ` +'Add that email to your GitHub account (or redo those commits with your GitHub email), then push again or leave any comment here and I\'ll check again.');