Skip to content

Commit 3dfd16b

Browse files
.github/scripts/check_readme.sh: Added special project case
- In the previous implementation, the script would throw an error if the project missed a certain section in the project/README.md file (e.g. No "Supported parts" section) - To solve this issue and not introduce a new flag (the project/README.md files don't include any flags) this script was updated to include a function for 'special' projects (special = projects which can't respect the README.md files template). Simply add the 'special' project to the the list, here in the script, thus the workflows won't fail saying that the README.md files don't respect the template. - Also updated the .github/scripts/README.md file to reflect the changes Signed-off-by: Cristian Mihai Popa <[email protected]>
1 parent f46cfb6 commit 3dfd16b

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

.github/scripts/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ This script ensures that all HDL project directories contain properly formatted
3232
- **Board names** are uppercased and underscores are replaced with hyphens (e.g., `ad9081_fmca_ebz``AD9081-FMCA-EBZ`);
3333
- **Carrier names** are uppercased as-is (e.g., `de10nano``DE10NANO`), except for special carriers.
3434

35-
#### 3. Special carrier exceptions
35+
#### 3. Special projects exceptions
36+
37+
The following projects are allowed to use exceptions from the template in their project/README file:
38+
39+
- `xcvr_wizard`
40+
41+
#### 4. Special carrier exceptions
3642

3743
The following carriers are allowed to use underscore in their README titles and are not flagged for title mismatches:
3844

@@ -59,7 +65,7 @@ is_special_carrier() {
5965
}
6066
```
6167

62-
#### 4. Required sections
68+
#### 5. Required sections
6369

6470
- **Main board README** MUST contain:
6571
- `Building the project`
@@ -80,7 +86,7 @@ Include these flags on the first line of the README.md file, as a MarkDown comme
8086
<!-- no_build_example, no_dts, no_no_os -->
8187
```
8288

83-
#### 5. Forbidden content
89+
#### 6. Forbidden content
8490

8591
- Links to the following are not allowed:
8692
- `https://wiki.analog.com/resources/tools-software/linux-drivers-all`

.github/scripts/check_readme.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ is_special_carrier() {
3434
esac
3535
}
3636

37+
# Function to detect special projects (e.g., projects that need title check skipped)
38+
is_special_project() {
39+
case "$1" in
40+
xcvr_wizard)
41+
return 0
42+
;;
43+
*)
44+
return 1
45+
;;
46+
esac
47+
}
48+
3749
# Function to extract flags from first line of README
3850
extract_flags() {
3951
local file=$1
@@ -72,9 +84,16 @@ check_readme() {
7284
echo "$flags" | grep -q "$1"
7385
}
7486

75-
# Check title (skip for special carriers)
76-
if [ "$is_main_readme" -eq 0 ] && is_special_carrier "$carrier"; then
77-
:
87+
# Check title (skip for special carriers or special projects)
88+
if [ "$is_main_readme" -eq 0 ]; then
89+
if is_special_carrier "$carrier" || is_special_project "$board"; then
90+
:
91+
else
92+
if ! grep -q "$expected_title" "$file"; then
93+
echo " ✖ Incorrect or missing title. Expected: $expected_title"
94+
local_fail=1
95+
fi
96+
fi
7897
else
7998
if ! grep -q "$expected_title" "$file"; then
8099
echo " ✖ Incorrect or missing title. Expected: $expected_title"
@@ -89,7 +108,7 @@ check_readme() {
89108
local_fail=1
90109
fi
91110
fi
92-
if ! grep -q "Supported parts" "$file"; then
111+
if ! grep -q "Supported parts" "$file" && ! is_special_project "$board"; then
93112
echo " ✖ Missing section \"Supported parts\""
94113
local_fail=1
95114
fi

0 commit comments

Comments
 (0)