Merge pull request #12 from D-Modem/claude/project-thread-xqjct0

Contributor agreement: copyright assignment and a sign-off check
This commit is contained in:
Neo authored and GitHub committed 2026-11-08 03:27:40 -08:00
commit b9953199be
2 files changed
+91 -9

No files matched your search

@@ -0,0 +1,62 @@
# The contributor agreement (CONTRIBUTING.md): every commit in a pull
# request carries a "Signed-off-by:" line with its author's email, which
# says the author agrees to it for that commit. Merge commits are
# skipped. Pull requests opened by the repository's owner or the D-Modem
# organization's members, and by bots, are not checked.
#
# pull_request_target, so that the check is the base branch's copy and a
# pull request can't change it. It reads the commits through the API and
# never checks out or runs the pull request's code.
name: Contributor agreement
on:
pull_request_target:
types: [opened, synchronize, reopened]
permissions:
pull-requests: read
concurrency:
group: contributor-agreement-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
sign-off:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/github-script@v8
with:
script: |
const pr = context.payload.pull_request;
const exempt = ['OWNER', 'MEMBER'];
if (pr.user.type === 'Bot' || exempt.includes(pr.author_association)) {
core.info(`Opened by ${pr.user.login} (${pr.author_association}): not checked.`);
return;
}
const commits = await github.paginate(github.rest.pulls.listCommits, {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
per_page: 100,
});
const missing = [];
for (const c of commits) {
if (c.parents.length > 1) continue;
const email = (c.commit.author.email || '').toLowerCase();
const signed = [...c.commit.message.matchAll(/^Signed-off-by:.*<([^>]+)>\s*$/gim)]
.some(m => m[1].trim().toLowerCase() === email);
if (!signed) {
missing.push(`${c.sha.slice(0, 7)} ${c.commit.message.split('\n')[0]} (author ${email})`);
}
}
if (missing.length) {
core.setFailed(
'These commits have no "Signed-off-by:" line with their author\'s email, ' +
'which says you agree to the contributor agreement in CONTRIBUTING.md:\n ' +
missing.join('\n ') +
'\n\nTo add it: git rebase --signoff ' + pr.base.ref +
' (or git commit --amend -s for the last commit), then force-push.');
} else {
core.info(`All ${commits.length} commits are signed off.`);
}
+29 -9
View File
@@ -16,16 +16,29 @@ any other code or text meant for inclusion), you agree that:
infringes no one's rights. If your employer has rights in what you
create, you have its permission to contribute, or it has waived those
rights.
2. You keep the copyright in your contribution.
3. You grant the D-Modem Authors, and those who receive the project from them, a
2. You assign to D-Modem all copyright in your contribution, worldwide,
for the whole term of those rights. "D-Modem" here is the D-Modem
organization (<https://github.com/D-Modem>), whose rights its owner,
Neo-Desktop, holds on its behalf; the "D-Modem Authors" in the
project's copyright notices are D-Modem in this sense. Where a right
can't be assigned (moral rights, for example), you waive it, or where
it can't be waived, you agree not to assert it against D-Modem or
those who receive the project from it. If the assignment is not
effective anywhere, you instead grant D-Modem there an exclusive,
perpetual, worldwide, no-charge, royalty-free, irrevocable license to
do anything the copyright holder could do with your contribution,
including licensing it to others.
3. D-Modem may license your contribution, and works based on it, under
the AGPL-3.0 and under any other terms, commercial licenses included.
It licenses your contribution back to you: a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable license to use,
copy, modify, publicly display and perform, sublicense and distribute
it, on any terms.
4. You grant D-Modem, and those who receive the project from it, a
perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable license to use, copy, modify, publicly display and
perform, sublicense and distribute your contribution and works based
on it, under the AGPL-3.0 and under any other terms, commercial
licenses included.
4. You grant the same parties a license, on the same terms, under any
patent claims of yours that your contribution would infringe, to
make, use, sell and otherwise transfer it as part of the project.
irrevocable license under any patent claims of yours that your
contribution would infringe, to make, use, sell and otherwise
transfer it as part of the project.
5. Your contribution is provided "as is", without warranties or
conditions of any kind.
@@ -36,3 +49,10 @@ does it):
It says that you agree to the above for that commit. A contribution
without it cannot be merged.
A check on each pull request looks for that line, with the commit
author's email, on every commit. If it's missing, `git rebase --signoff
main` (or `git commit --amend -s` for the last commit) adds it; then
force-push. Pull requests from the D-Modem Authors themselves (the
repository's owner and the D-Modem organization's members) are not
checked.