Skip to content

Commit 146aa30

Browse files
committed
Merge branch 'main' of github.com:romkey/pdxhackerspace-hackstack
2 parents 5c868e0 + 1462bcf commit 146aa30

2 files changed

Lines changed: 22 additions & 9 deletions

File tree

.github/workflows/concatenate_gitignore.yml

Lines changed: 21 additions & 8 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
@@ -46,4 +59,4 @@ jobs:
4659
git config --global user.email "github-actions[bot]@users.noreply.github.com"
4760
git add .gitignore
4861
git commit -m "Update top-level .gitignore with directory paths"
49-
git push
62+
git push origin HEAD:${GITHUB_REF_NAME}

.github/workflows/concatenate_rsync_exclude.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
git config --global user.email "github-actions[bot]@users.noreply.github.com"
4848
git add .rsync.exclude
4949
git commit -m "Update top-level .rsync.exclude with directory paths"
50-
git push
50+
git push origin HEAD:${GITHUB_REF_NAME}

0 commit comments

Comments
 (0)