-
Notifications
You must be signed in to change notification settings - Fork 793
32 lines (29 loc) · 1.11 KB
/
release-note-file.yml
File metadata and controls
32 lines (29 loc) · 1.11 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
name: Check Release Notes Filenames
on:
pull_request:
jobs:
check-filenames:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2 # Ensures we have at least one previous commit for diffing
- name: Find invalid filenames in added/modified files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only --diff-filter=A origin/${{ github.base_ref }} | grep '^source/releasenotes/' | while read -r file; do
filename=$(basename "$file")
name="${filename%.*}" # Remove only the last extension
ext="${filename##*.}"
# Check for multiple dots in the filename (excluding extension)
if [[ "$name" == *.* ]]; then
echo "Invalid file: $file (multiple dots in filename)"
exit 1
fi
# Check for missing .md extension
if [[ "$ext" != "md" ]]; then
echo "Invalid file: $file (missing .md extension)"
exit 1
fi
done