Skip to content

Commit 951e264

Browse files
committed
Update gitignore workflow: support apps/ and experimental/ parent dirs
- Search apps/**/.gitignore and experimental/**/.gitignore (depth 3) instead of the old depth-2 search that predates the apps/ layout - Include parent directory name in each section header, e.g. # [apps] apps/cups/.gitignore - Sort files within each parent for deterministic output - Skip parent directories that don't exist yet (experimental/) - Update push trigger paths to match new locations Made-with: Cursor
1 parent af6c8f7 commit 951e264

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

.github/workflows/concatenate_gitignore.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Update .gitignore
33
on:
44
push:
55
paths:
6-
- "**/.gitignore"
6+
- "apps/**/.gitignore"
7+
- "experimental/**/.gitignore"
78
- ".gitignore.initial"
89
workflow_dispatch:
910

@@ -22,12 +23,24 @@ jobs:
2223
run: |
2324
# Start with the initial .gitignore file
2425
cp .gitignore.initial .gitignore
25-
26-
# Find all .gitignore files one level down, process each with its path prefix
27-
find . -mindepth 2 -maxdepth 2 -name ".gitignore" | while read -r gitignore_file; do
28-
dir_path=$(dirname "$gitignore_file" | sed 's|^\./||')
29-
echo -e "\n# Patterns from $dir_path/.gitignore" >> .gitignore
30-
sed "s|^|$dir_path/|" "$gitignore_file" >> .gitignore
26+
27+
# Process each known parent directory in order.
28+
# Patterns are prefixed with the full path from the repo root so
29+
# they work correctly from the top-level .gitignore.
30+
# The section header names the parent directory so the origin of
31+
# each block is clear.
32+
for parent_dir in apps experimental; do
33+
if [ ! -d "$parent_dir" ]; then
34+
continue
35+
fi
36+
37+
find "$parent_dir" -mindepth 2 -maxdepth 2 -name ".gitignore" | sort | \
38+
while read -r gitignore_file; do
39+
dir_path=$(dirname "$gitignore_file")
40+
echo "" >> .gitignore
41+
echo "# [$parent_dir] $dir_path/.gitignore" >> .gitignore
42+
sed "s|^|$dir_path/|" "$gitignore_file" >> .gitignore
43+
done
3144
done
3245
3346
- name: Check for changes

0 commit comments

Comments
 (0)