Skip to content

Commit 77ca586

Browse files
committed
Require Developer Certificate of Origin (DCO)
Signed-off-by: Jakub Zelenka <bukka@php.net>
1 parent 8376904 commit 77ca586

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

.github/workflows/dco.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: DCO Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
dco:
9+
name: Check Signed-off-by in commits
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Fetch base branch
19+
run: git fetch origin ${{ github.base_ref }}
20+
21+
- name: Check commits for Signed-off-by
22+
run: |
23+
git log --pretty=format:"%H %P %s%n%b%n==END==" origin/${{ github.base_ref }}...HEAD |
24+
awk '
25+
BEGIN { commit = ""; parent_count = 0; has_signed_off = 0; }
26+
/^[0-9a-f]{40} / {
27+
commit = $1;
28+
n = split($0, parts, " ");
29+
parent_count = n - 2;
30+
next;
31+
}
32+
/==END==/ {
33+
if (parent_count < 2 && !has_signed_off) {
34+
print "Commit " commit " is missing Signed-off-by";
35+
exit 1;
36+
}
37+
commit = "";
38+
parent_count = 0;
39+
has_signed_off = 0;
40+
next;
41+
}
42+
/Signed-off-by:/ { has_signed_off = 1; }
43+
'

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,27 @@ and build PHP source code. We recommend to look at our
5959
[workflow](https://wiki.php.net/vcs/gitworkflow) and our
6060
[FAQ](https://wiki.php.net/vcs/gitfaq).
6161

62+
All contributions must comply with the Developer Certificate of Origin.
63+
64+
Each commit must include a Signed-off-by line with your name and email address.
65+
66+
You can add it automatically by using:
67+
68+
```bash
69+
git commit -s
70+
```
71+
72+
Example commit message:
73+
74+
```
75+
Fix bug in X
76+
77+
Signed-off-by: Jane Developer <jane@example.com>
78+
```
79+
80+
By signing off, you confirm that you have the right to submit your code under the
81+
PHP License.
82+
6283
## Filing bugs
6384

6485
Bugs can be filed on [GitHub Issues](https://github.com/php/php-src/issues/new/choose).

DCO.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Developer Certificate of Origin
2+
Version 1.1
3+
4+
Copyright (C) 2025-present PHP Group and its contributors.
5+
6+
Everyone is permitted to copy and distribute verbatim copies of this
7+
license document, but changing it is not allowed.
8+
9+
10+
Developer's Certificate of Origin 1.1
11+
12+
By making a contribution to this project, I certify that:
13+
14+
(a) The contribution was created in whole or in part by me and I
15+
have the right to submit it under the open source license
16+
indicated in the file; or
17+
18+
(b) The contribution is based upon previous work that, to the best
19+
of my knowledge, is covered under an appropriate open source
20+
license and I have the right under that license to submit that
21+
work with modifications, whether created in whole or in part
22+
by me, under the same open source license (unless I am
23+
permitted to submit under a different license), as indicated
24+
in the file; or
25+
26+
(c) The contribution was provided directly to me by some other
27+
person who certified (a), (b) or (c) and I have not modified
28+
it.
29+
30+
(d) I understand and agree that this project and the contribution
31+
are public and that a record of the contribution (including all
32+
personal information I submit with it, including my sign-off) is
33+
maintained indefinitely and may be redistributed consistent with
34+
this project or the open source license(s) involved.

0 commit comments

Comments
 (0)