added Dozzle (logs) and peaNUT (UPS) support #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update .gitignore | |
| on: | |
| push: | |
| paths: | |
| - "**/.gitignore" | |
| - ".gitignore.initial" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-gitignore: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Concatenate .gitignore files with directory paths | |
| run: | | |
| # Start with the initial .gitignore file | |
| cp .gitignore.initial .gitignore | |
| # Find all .gitignore files one level down, process each with its path prefix | |
| find . -mindepth 2 -maxdepth 2 -name ".gitignore" | while read -r gitignore_file; do | |
| dir_path=$(dirname "$gitignore_file" | sed 's|^\./||') | |
| echo -e "\n# Patterns from $dir_path/.gitignore" >> .gitignore | |
| sed "s|^|$dir_path/|" "$gitignore_file" >> .gitignore | |
| done | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if [[ -n "$(git status --porcelain .gitignore)" ]]; then | |
| echo "changes=true" >> $GITHUB_ENV | |
| else | |
| echo "changes=false" >> $GITHUB_ENV | |
| fi | |
| - name: Commit and push if changes exist | |
| if: env.changes == 'true' | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add .gitignore | |
| git commit -m "Update top-level .gitignore with directory paths" | |
| git push |