From nobody Fri Jan 24 20:50:51 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Yfqj54m8Zz5ltlJ for ; Fri, 24 Jan 2025 20:51:05 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yfqj50kbsz3dp9 for ; Fri, 24 Jan 2025 20:51:05 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3862a921123so1692579f8f.3 for ; Fri, 24 Jan 2025 12:51:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737751863; x=1738356663; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=waEJUfbRTXYqyQG2ZDsWZQGVhv+WfWD/Jf53NnWfcfs=; b=LUgdKAwf2FJahCyLIyA1BoylSXLIgUUaWeFGgnHDz6KRIHZxQ7727qjvP2G2TaWz2Q D8CqviyXhoeitmTtK5oUbFbLezDEo44Sossqudhf1GUsEcGKKXXMb9sttXPOaM8bUtkd IKWGbzNwIL9AzAIyKtVpVLZSSHWJFfr1CLAu4V0hi25iyOzKvcmX/QfDyqBRdf9P6nMU kGZVzSjJuIo16gxX2ZCMLEgqOgv3/0sUxVFxohJyYbjXs6MdRfSAiPLYhbgpB5g4B+DT O2/FhABeqECa81KXcbkngbL2/grK/8t/StK31nambbM8Y97+fsaAG7iRJEOzu2GjfW5E sjVQ== X-Forwarded-Encrypted: i=1; AJvYcCUXWneGKWFyby3b82K7Irg3/Eics8zNGxlQC7mB1a2xPmO3tH/1+jZqMXQkXovF0Y4p5h1zsIry9x8uGXFA6yvKZBWM@freebsd.org X-Gm-Message-State: AOJu0Yy6HP9SAHt3srGw62myzvQMVw0icZ3MzA5CSOtT5FCzP+9vQ4En J+MvN0Hjqjej/wFHvYj/9zsQTdgEz5pwfuBgjbniWzjmo/y+OH54ZfJmA0erXTo= X-Gm-Gg: ASbGncs1FtuOEx+YSyfXeGQidkOt9xVsVDe7j29bOezFkExObf+cl5UnQMVUGUZvqyJ RgxBuuGtCEMHece2EEjyT06LMhAtXKAXFQ41ACApmToxPebqP1iNgGksBE6okPXfcmWwRqi5ELZ t1Nx3KXvAV/4WVIEJKvRbIki2rj0tWPuPFHDggEiAPVHaho2+VEnMfjZUFODBJUU24RM3Kbx/wH ASN3cmQrpqeGEIf4hNyxrCM9ZeBkF8qEQ3SrJqO+ZT3Ghkwew7ga52Dq3lJUmkyP7MMUnbTCnAi SKnwbPR5ACWfYHugvYY= X-Google-Smtp-Source: AGHT+IEiGKN1oRRPgv1zR4Y8Crl48LCkzaF+shATYoUDI6/rFaMfz9rFR/KdNbWU+Y3F+G5NgvYn9Q== X-Received: by 2002:a05:6000:1449:b0:386:3825:2c3b with SMTP id ffacd0b85a97d-38bf5663880mr29643930f8f.18.1737751862731; Fri, 24 Jan 2025 12:51:02 -0800 (PST) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a17d6d7sm3757244f8f.31.2025.01.24.12.51.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jan 2025 12:51:02 -0800 (PST) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: git: a9a6a51edac1 - main - github: Add new checklist workflow From: Jessica Clarke In-Reply-To: <202501242027.50OKRiIe064626@gitrepo.freebsd.org> Date: Fri, 24 Jan 2025 20:50:51 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202501242027.50OKRiIe064626@gitrepo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3826.300.87.4.3) X-Rspamd-Queue-Id: 4Yfqj50kbsz3dp9 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] On 24 Jan 2025, at 20:27, Ed Maste wrote: >=20 > The branch main has been updated by emaste: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Da9a6a51edac13aaff5517dd602272152= efa6d7bd >=20 > commit a9a6a51edac13aaff5517dd602272152efa6d7bd > Author: Ahmad Khalifa > AuthorDate: 2025-01-05 05:01:07 +0000 > Commit: Ed Maste > CommitDate: 2025-01-24 20:27:08 +0000 >=20 > github: Add new checklist workflow >=20 > Add a new 'checklist' workflow that checks the commit messages on = pull > requests. Currently, the workflow creates a comment on the pull = request > if any of these conditions are hit: > - Missing Signed-off-by > - Malformed Signed-off-by > - Bad email (i.e *noreply*) >=20 > Reviewed by: emaste, imp > Pull request: https://github.com/freebsd/freebsd-src/pull/1570 >=20 > Signed-off-by: Ahmad Khalifa > --- > .github/workflows/checklist.yml | 106 = ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 106 insertions(+) >=20 > diff --git a/.github/workflows/checklist.yml = b/.github/workflows/checklist.yml > new file mode 100644 > index 000000000000..9734af4a1a1d > --- /dev/null > +++ b/.github/workflows/checklist.yml > @@ -0,0 +1,106 @@ > +name: Checklist > + > +# Produce a list of things that need to be changed > +# for the submission to align with CONTRIBUTING.md > + > +on: > + pull_request: > + types: [ opened, reopened, edited, synchronize ] > + > +permissions: > + pull-requests: write > + > +jobs: > + checklist: > + name: commit > + runs-on: ubuntu-latest Please be careful to restrict these kinds of jobs with if: github.repository_owner =3D=3D 'freebsd' or if: github.repository =3D=3D 'freebsd/freebsd-src' otherwise it=E2=80=99s a pain for forks. Jess > + steps: > + - uses: actions/github-script@v7 > + with: > + # An asynchronous javascript function > + script: | > + /* > + * Github's API returns the results in pages of 30, so > + * pass the function we want, along with it's arguments, > + * to paginate() which will handle gathering all the = results. > + */ > + const comments =3D await = github.paginate(github.rest.issues.listComments, { > + owner: context.repo.owner, > + repo: context.repo.repo, > + issue_number: context.issue.number > + }); > + > + const commits =3D await = github.paginate(github.rest.pulls.listCommits, { > + owner: context.repo.owner, > + repo: context.repo.repo, > + pull_number: context.issue.number > + }); > + > + let checklist =3D {}; > + let checklist_len =3D 0; > + let comment_id =3D -1; > + > + const msg_prefix =3D "Thank you for taking the time to = contribute to FreeBSD!\n"; > + const addToChecklist =3D (msg, sha) =3D> { > + if (!checklist[msg]) { > + checklist[msg] =3D []; > + checklist_len++; > + } > + checklist[msg].push(sha); > + } > + > + for (const commit of commits) { > + const sob_lines =3D = commit.commit.message.match(/^[^\S\r\n]*signed-off-by:.*/gim); > + > + if (sob_lines =3D=3D null && = !commit.commit.author.email.toLowerCase().endsWith("freebsd.org")) > + addToChecklist("Missing Signed-off-by lines", = commit.sha); > + else if (sob_lines !=3D null) { > + let author_signed =3D false; > + for (const line of sob_lines) { > + if (!line.includes("Signed-off-by: ")) > + /* Only display the part we care about. */ > + addToChecklist("Expected `Signed-off-by: `, got = `" + line.match(/^[^\S\r\n]*signed-off-by:./i) + "`", commit.sha); > + if (line.includes(commit.commit.author.email)) > + author_signed =3D true; > + } > + > + if (!author_signed) > + console.log("::warning = title=3DMissing-Author-Signature::Missing Signed-off-by from author"); > + } > + > + if = (commit.commit.author.email.toLowerCase().includes("noreply")) > + addToChecklist("Real email address is needed", = commit.sha); > + } > + > + /* Check if we've commented before. */ > + for (const comment of comments) { > + if (comment.user.login =3D=3D "github-actions[bot]") { > + comment_id =3D comment.id; > + break; > + } > + } > + > + if (checklist_len !=3D 0) { > + let msg =3D msg_prefix + > + "There " + (checklist_len > 1 ? "are a few issues = that need " : "is an issue that needs ") + > + "to be fixed:\n"; > + let comment_func =3D comment_id =3D=3D -1 ? = github.rest.issues.createComment : github.rest.issues.updateComment; > + > + /* Loop for each key in "checklist". */ > + for (const c in checklist) > + msg +=3D "- " + c + "" + checklist[c].join(", ") = + "\n"; > + > + comment_func({ > + owner: context.repo.owner, > + repo: context.repo.repo, > + body: msg, > + ...(comment_id =3D=3D -1 ? {issue_number: = context.issue.number} : {comment_id: comment_id}) > + }); > + } else if (comment_id !=3D -1) { > + github.rest.issues.updateComment({ > + owner: context.repo.owner, > + repo: context.repo.repo, > + comment_id: comment_id, > + body: msg_prefix + "All issues resolved." > + }); > + }