Skip to content

Commit 6e48b12

Browse files
committed
Restore GitHub workflows
Signed-off-by: NVSRahul <nvsrahul@hotmail.com>
1 parent 749ca78 commit 6e48b12

6 files changed

Lines changed: 449 additions & 0 deletions

File tree

.github/CODEOWNERS

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Please note that the content of this file is strictly advisory.
2+
# No locks listed here are valid. The only strict review requirements
3+
# are granted by core. These are documented in head/LOCKS and enforced
4+
# by gitadm@.
5+
#
6+
# The source tree is a community effort. However, some folks go to the
7+
# trouble of looking after particular areas of the tree. In return for
8+
# their active caretaking of the code it is polite to coordinate changes
9+
# with them. This is a list of people who have expressed an interest in
10+
# part of the code or listed their active caretaking role so that other
11+
# committers can easily find somebody who is familiar with it. The notes
12+
# should specify if there is a 3rd party source tree involved or other
13+
# things that should be kept in mind.
14+
#
15+
# However, this is not a 'big stick', it is an offer to help and a
16+
# source of guidance. It does not override the communal nature of the
17+
# tree. It is not a registry of 'turf' or private property.
18+
#
19+
# ***
20+
# This list is prone to becoming stale quickly. The best way to find the
21+
# recent maintainer of a sub-system is to check recent logs for that
22+
# directory or sub-system.
23+
# ***
24+
#
25+
# ***
26+
# Maintainers are encouraged to visit:
27+
# https://reviews.freebsd.org/herald
28+
#
29+
# and configure Phabricator notifications for parts of the tree which
30+
# they maintain. Notifications can automatically be sent when someone
31+
# proposes a revision or makes a commit to the specified subtree.
32+
# ***
33+
34+
/bin/sh @jillest
35+
/contrib/atf @ngie-eign
36+
/contrib/capsicum-test @ngie-eign
37+
/contrib/googletest @ngie-eign
38+
/contrib/libcxxrt @DimitryAndric @emaste
39+
/contrib/llvm-project @DimitryAndric
40+
/contrib/llvm-project/libunwind @DimitryAndric @emaste @bsdjhb
41+
/contrib/llvm-project/lldb @DimitryAndric @emaste
42+
/contrib/llvm-project/openmp @DimitryAndric @emaste
43+
/contrib/mandoc @concussious
44+
/contrib/netbsd-tests @ngie-eign
45+
/contrib/netbsd-tests/crypto/opencrypto/ @jmgurney
46+
/contrib/netbsd-tests/kernel/kqueue/ @jmgurney
47+
/contrib/one-true-awk/ @bsdimp
48+
/contrib/openpam/lib/libpam/ @dag-erling
49+
/contrib/pjdfstest @ngie-eign @asomers
50+
/crypto/openssh @dag-erling
51+
/crypto/openssl/ @juikim
52+
/etc/mail @gshapiro
53+
/etc/sendmail @gshapiro
54+
/lib/libc/sys/kevent.c @jmgurney
55+
/lib/libefivar/ @bsdimp
56+
/lib/libfetch @dag-erling
57+
/lib/libfigpar @dag-erling
58+
/lib/libpam/ @dag-erling
59+
/lib/libsecureboot/ @stephane-rochoy-stormshield
60+
/lib/libveriexec/ @stephane-rochoy-stormshield
61+
/lib/libvmmapi @bsdjhb @bryanv @markjdb @khng300 @markpeek
62+
/libexec/nuageinit/ @bapt
63+
/libexec/rc/rc.d/rctl/ @trasz
64+
/sbin/ipf @cschuber
65+
/sbin/mount_fusefs @asomers
66+
/sbin/nvmecontrol @bsdimp
67+
/sbin/veriexec/ @stephane-rochoy-stormshield
68+
/secure/usr.bin/openssl/ @juikim
69+
/share/man/ @concussious
70+
/share/mk @bsdimp @bapt @bdrewery @emaste
71+
/stand @bsdimp
72+
/stand/lua @kevans91
73+
/stand/veriexec.mk @stephane-rochoy-stormshield
74+
/sys/amd64/pci @bsdimp @bsdjhb
75+
/sys/amd64/vmm/ @bsdjhb @bryanv @markjdb @khng300 @markpeek
76+
/sys/arm/allwinner @evadot
77+
/sys/arm64/arm64 @zxombie
78+
/sys/arm64/include @zxombie
79+
/sys/arm64/rockchip @evadot
80+
/sys/compat/linprocfs/ @dag-erling
81+
/sys/crypto/openssl/ @juikim
82+
/sys/dev/drm2 @bsdimp
83+
/sys/dev/ftgpio/ @stephane-rochoy-stormshield
84+
/sys/dev/ftwd/ @stephane-rochoy-stormshield
85+
/sys/dev/iscsi/ @trasz
86+
/sys/dev/nctgpio/ @stephane-rochoy-stormshield
87+
/sys/dev/ncthwm/ @stephane-rochoy-stormshield
88+
/sys/dev/mpi3mr @bsdimp
89+
/sys/dev/mps @bsdimp
90+
/sys/dev/mpr @bsdimp
91+
/sys/dev/nvd @bsdimp
92+
/sys/dev/nvme @bsdimp
93+
/sys/dev/pci @bsdimp @bsdjhb
94+
/sys/dev/superio/ @stephane-rochoy-stormshield
95+
/sys/dev/veriexec/ @stephane-rochoy-stormshield
96+
/sys/fs/autofs/ @trasz
97+
/sys/fs/fuse/ @asomers
98+
/sys/fs/procfs/ @dag-erling
99+
/sys/fs/pseudofs/ @dag-erling
100+
/sys/kern/vfs_aio.c @asomers
101+
/sys/netinet/ip_carp.c @glebius
102+
/sys/netpfil/ipfilter @cschuber
103+
/sys/netpfil/pf @glebius
104+
/sys/opencrypto/ @jmgurney
105+
/sys/security/mac_veriexec/ @stephane-rochoy-stormshield
106+
/sys/security/mac_veriexec_parser/ @stephane-rochoy-stormshield
107+
/sys/x86/pci @bsdimp @bsdjhb
108+
/tests @ngie-eign
109+
/tests/sys/aio/ @asomers
110+
/tests/sys/fs/fusefs/ @asomers
111+
/tests/sys/kqueue/ @jmgurney
112+
/tests/sys/opencrypto/ @jmgurney
113+
/tools/build @bsdimp
114+
/tools/regression/iscsi/ @trasz
115+
/tools/regression/sockets/kqueue/ @jmgurney
116+
/tools/tools/nanobsd @bsdimp
117+
/usr.bin/fetch @dag-erling
118+
/usr.bin/rctl/ @trasz
119+
/usr.bin/top @grimreaper
120+
/usr.sbin/autofs/ @trasz
121+
/usr.sbin/bhyve @bsdjhb @bryanv @markjdb @khng300 @markpeek
122+
/usr.sbin/bhyvectl @bsdjhb @bryanv @markjdb @khng300 @markpeek
123+
/usr.sbin/bhyveload @bsdjhb @bryanv @markjdb @khng300 @markpeek
124+
/usr.sbin/lpr @gbergling
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Please include this information, either here or in your commit messages for the
2+
pull request, as appropriate (or delete the line if there's nothing relevant.
3+
4+
PR: <If and which Problem Report is related.>
5+
Reported by: <If someone else reported the issue.>
6+
Reviewed by: <If someone else reviewed your modification.>
7+
Tested by: <If someone else tested the change.>
8+
Approved by: <If you needed approval for this commit.>
9+
Obtained from: <If the change is from a third party.>
10+
Fixes: <Short hash and title line of commit fixed by this change>
11+
MFC after: <N [day[s]|week[s]|month[s]]. Request a reminder email>
12+
Relnotes: <Set to 'yes' for mention in release notes.>
13+
Security: <Vulnerability reference (one per line) or description.>
14+
Sponsored by: <If the change was sponsored by an organization.>
15+
Pull Request: <https://github.com/freebsd/<repo>/pull/###>
16+
Differential Revision: <https://reviews.freebsd.org/D###>

.github/path-rules.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Format the similar to CODEOWNERS: Each line has a path, whitespace and a
3+
# message for contributors.
4+
#
5+
sys/contrib/device-tree :caution: No changes should be made here by pull request
6+
# Catch all
7+
contrib :warning: Contributed software usually managed by vendor branch
8+
crypto :warning: Contributed crypto software usually managed by vendor branch
9+
sys/contrib :warning: Contributed software usually managed by vendor branch
10+
sys/crypto :warning: Contributed crypto software usually managed by vendor branch

.github/workflows/checklist.yml

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
name: Checklist
2+
3+
# Produce a list of things that need to be changed
4+
# for the submission to align with CONTRIBUTING.md
5+
6+
on:
7+
pull_request_target:
8+
types: [ opened, reopened, edited, synchronize ]
9+
10+
permissions:
11+
pull-requests: write
12+
13+
jobs:
14+
checklist:
15+
name: commit
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/github-script@v7
19+
with:
20+
# An asynchronous javascript function
21+
script: |
22+
/*
23+
* Github's API returns the results in pages of 30, so
24+
* pass the function we want, along with it's arguments,
25+
* to paginate() which will handle gathering all the results.
26+
*/
27+
const comments = await github.paginate(github.rest.issues.listComments, {
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
issue_number: context.issue.number
31+
});
32+
33+
const commits = await github.paginate(github.rest.pulls.listCommits, {
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
pull_number: context.issue.number
37+
});
38+
39+
/* Get owners */
40+
41+
let owners = [];
42+
const { data: ownerData } = await github.rest.repos.getContent({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
path: '.github/CODEOWNERS',
46+
ref: context.payload.pull_request.base.ref // Or a specific branch
47+
});
48+
const oc = Buffer.from(ownerData.content, 'base64').toString();
49+
owners = oc.split(/\r?\n/)
50+
.map(line => line.trim())
51+
// Filter out comments and empty lines
52+
.filter(line => line && !line.startsWith('#'))
53+
.map(line => {
54+
// Split by the first block of whitespace to separate path and message
55+
const [path, ...ownerParts] = line.substring(1).split(/\s+/);
56+
return { path, owner: ownerParts.join(' ') };
57+
});
58+
59+
/* Get rules -- maybe refactor to a function for ownerPath too */
60+
let rules = [];
61+
const { data: rulesData } = await github.rest.repos.getContent({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
path: '.github/path-rules.txt',
65+
ref: context.payload.pull_request.base.ref // Or a specific branch
66+
});
67+
const rc = Buffer.from(rulesData.content, 'base64').toString();
68+
rules = rc.split(/\r?\n/)
69+
.map(line => line.trim())
70+
// Filter out comments and empty lines
71+
.filter(line => line && !line.startsWith('#'))
72+
.map(line => {
73+
// Split by the first block of whitespace to separate path and message
74+
const [path, ...messageParts] = line.split(/\s+/);
75+
return { path, message: messageParts.join(' ') };
76+
});
77+
78+
let checklist = {};
79+
let checklist_len = 0;
80+
let comment_id = -1;
81+
82+
const addToChecklist = (msg, sha) => {
83+
if (!checklist[msg]) {
84+
checklist[msg] = [];
85+
checklist_len++;
86+
}
87+
checklist[msg].push(sha);
88+
}
89+
90+
for (const commit of commits) {
91+
const sob_lines = commit.commit.message.match(/^[^\S\r\n]*signed-off-by:.*/gim);
92+
93+
if (sob_lines == null && !commit.commit.author.email.toLowerCase().endsWith("freebsd.org"))
94+
addToChecklist("Missing Signed-off-by lines", commit.sha);
95+
else if (sob_lines != null) {
96+
let author_signed = false;
97+
for (const line of sob_lines) {
98+
if (!line.includes("Signed-off-by: "))
99+
/* Only display the part we care about. */
100+
addToChecklist("Expected `Signed-off-by: `, got `" + line.match(/^[^\S\r\n]*signed-off-by:./i) + "`", commit.sha);
101+
if (line.includes(commit.commit.author.email))
102+
author_signed = true;
103+
}
104+
105+
if (!author_signed)
106+
console.log("::warning title=Missing-Author-Signature::Missing Signed-off-by from author");
107+
}
108+
109+
if (commit.commit.author.email.toLowerCase().includes("noreply"))
110+
addToChecklist("Real email address is needed", commit.sha);
111+
}
112+
113+
/* Check for different paths that have issues and/or owners */
114+
const { data: files } = await github.rest.pulls.listFiles({
115+
owner: context.repo.owner,
116+
repo: context.repo.repo,
117+
pull_number: context.payload.pull_request.number,
118+
});
119+
120+
let infolist = {};
121+
let infolist_len = 0;
122+
const addToInfolist = (msg) => {
123+
if (!infolist[msg]) {
124+
infolist[msg] = [];
125+
infolist_len++;
126+
}
127+
}
128+
129+
/* Give advice based on what's in the commit */
130+
for (const file of files) {
131+
for (const owner of owners) {
132+
if (file.filename.startsWith(owner.path)) {
133+
addToInfolist("> [!IMPORTANT]\n> " + owner.owner + " wants to review changes to " + owner.path + "\n");
134+
}
135+
}
136+
for (const rule of rules) {
137+
// Consider regexp in the future maybe?
138+
if (file.filename.startsWith(rule.path)) {
139+
if (rule.message.startsWith(":caution: ")) {
140+
addToInfolist("> [!CAUTION]\n> " + rule.path + ": " + rule.message.substring(10) + "\n");
141+
} else if (rule.message.startsWith(":warning: ")) {
142+
addToInfolist("> [!WARNING]\n> " + rule.path + ": " + rule.message.substring(10) + "\n");
143+
} else {
144+
addToInfolist("> [!IMPORTANT]\n> " + rule.path + ": " + rule.message + "\n");
145+
}
146+
}
147+
}
148+
}
149+
150+
/* Check if we've commented before. */
151+
for (const comment of comments) {
152+
if (comment.user.login == "github-actions[bot]") {
153+
comment_id = comment.id;
154+
break;
155+
}
156+
}
157+
158+
const msg_prefix = "Thank you for taking the time to contribute to FreeBSD!\n\n";
159+
if (checklist_len != 0 || infolist_len != 0) {
160+
let msg = msg_prefix;
161+
let comment_func = comment_id == -1 ? github.rest.issues.createComment : github.rest.issues.updateComment;
162+
if (checklist_len != 0) {
163+
msg +=
164+
"There " + (checklist_len > 1 ? "are a few issues that need " : "is an issue that needs ") +
165+
"to be resolved:\n";
166+
167+
/* Loop for each key in "checklist". */
168+
for (const c in checklist)
169+
msg += "- " + c + " (" + checklist[c].join(", ") + ")\n";
170+
msg += "\n> [!NOTE]\n> Please review [CONTRIBUTING.md](https://github.com/freebsd/freebsd-src/blob/main/CONTRIBUTING.md), then update and push your branch again.\n\n"
171+
} else {
172+
let msg = "No Issues found.\n\n";
173+
}
174+
if (infolist_len != 0) {
175+
msg += "Some of files have special handling:\n"
176+
for (const i in infolist)
177+
msg += i + "\n";
178+
msg += "\n\n";
179+
}
180+
comment_func({
181+
owner: context.repo.owner,
182+
repo: context.repo.repo,
183+
body: msg,
184+
...(comment_id == -1 ? {issue_number: context.issue.number} : {comment_id: comment_id})
185+
});
186+
} else if (comment_id != -1) {
187+
github.rest.issues.updateComment({
188+
owner: context.repo.owner,
189+
repo: context.repo.repo,
190+
comment_id: comment_id,
191+
body: msg_prefix + "All issues resolved."
192+
});
193+
}

0 commit comments

Comments
 (0)