-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (53 loc) · 1.7 KB
/
Copy pathrepository-health.yml
File metadata and controls
60 lines (53 loc) · 1.7 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Repository Health
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
health:
name: Baseline repository checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Check required maintenance files
shell: bash
run: |
set -euo pipefail
required=(
"README.md"
"CONTRIBUTING.md"
"SECURITY.md"
".github/PULL_REQUEST_TEMPLATE.md"
".github/dependabot.yml"
)
missing=()
for file in "${required[@]}"; do
if [[ ! -f "$file" ]]; then
missing+=("$file")
fi
done
if (( ${#missing[@]} )); then
printf 'Missing required repository file: %s\n' "${missing[@]}"
exit 1
fi
- name: Check for unresolved merge conflict markers
shell: bash
run: |
set -euo pipefail
if git grep -n -E '^(<{7}|>{7})([[:space:]].*)?$|^={7}$' -- ':!package-lock.json' ':!pnpm-lock.yaml' ':!yarn.lock'; then
echo "Unresolved merge conflict markers were found."
exit 1
fi
- name: Validate GitHub YAML files
shell: bash
run: |
set -euo pipefail
ruby -e 'require "yaml"; Dir[".github/workflows/*.{yml,yaml}", ".github/dependabot.y*ml", ".github/ISSUE_TEMPLATE/*.{yml,yaml}"].flatten.each { |path| YAML.load_file(path) }; puts "GitHub YAML files are valid"'