Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Use this template when creating a new project that should have consistent contri
./scripts/install-git-hooks.sh
```

6. Enable or replace the stack-specific CI example in `.github/workflows/ci.yml.example`.
6. Replace `.github/workflows/ci.yml.example` with a real `.github/workflows/ci.yml` for the project stack; the repository check accepts either file.
7. Keep `.github/workflows/review.yml` enabled for generic review checks.
8. Configure GitHub repository protection after the new repository is created:

Expand Down
27 changes: 20 additions & 7 deletions scripts/check-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ required_files=(
".github/ISSUE_TEMPLATE/bug_report.md"
".github/ISSUE_TEMPLATE/feature_request.md"
".github/workflows/review.yml"
".github/workflows/ci.yml.example"
# Alternatives separated by "|": a project replaces the example with its real CI.
".github/workflows/ci.yml|.github/workflows/ci.yml.example"
".gitlab/merge_request_templates/default.md"
".githooks/pre-commit"
"scripts/check-pr-body.sh"
Expand All @@ -69,14 +70,26 @@ required_files=(
"docs/plans/0000-template.md"
)

missing=()
for file in "${required_files[@]}"; do
file_present() {
if [[ "$staged" == true ]]; then
if ! git cat-file -e ":$file" 2>/dev/null; then
missing+=("$file")
git cat-file -e ":$1" 2>/dev/null
else
[[ -f "$1" ]]
fi
}

missing=()
for entry in "${required_files[@]}"; do
found=false
IFS='|' read -r -a alternatives <<<"$entry"
for file in "${alternatives[@]}"; do
if file_present "$file"; then
found=true
break
fi
elif [[ ! -f "$file" ]]; then
missing+=("$file")
done
if [[ "$found" == false ]]; then
missing+=("${entry//|/ or }")
fi
done

Expand Down
Loading