generated from USP-Open-Code/discipline-template
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.29 KB
/
structure-validation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Validate Repository Structure
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
validate-structure:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Validate Repository Structure
run: |
# Ensure the main README.md exists
if [ ! -f "README.md" ]; then
echo "Root README.md is missing. Please add a README.md with discipline name and code."
exit 1
fi
# Ensure each task folder has a README.md and no unauthorized files
for dir in */ ; do
if [ ! -f "${dir}/README.md" ]; then
echo "Task ${dir} is missing a README.md. Each task folder must have a README.md file with the task description."
exit 1
fi
# Check that every file in the task folder follows the author naming convention
for file in "${dir}"*; do
filename=$(basename "$file")
if [[ "$filename" != *"."* ]]; then
echo "File ${filename} in ${dir} does not follow the naming convention. It should be named as 'author.extension'."
exit 1
fi
done
done
echo "Repository structure is valid."