LiteLLM .gitignore #88
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: | |
| - "apps/**/.gitignore" | |
| - "experiments/**/.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 | |
| # Process each known parent directory in order. | |
| # Patterns are prefixed with the full path from the repo root so | |
| # they work correctly from the top-level .gitignore. | |
| # The section header names the parent directory so the origin of | |
| # each block is clear. | |
| for parent_dir in apps experiments; do | |
| if [ ! -d "$parent_dir" ]; then | |
| continue | |
| fi | |
| find "$parent_dir" -mindepth 2 -maxdepth 2 -name ".gitignore" | sort | \ | |
| while read -r gitignore_file; do | |
| dir_path=$(dirname "$gitignore_file") | |
| echo "" >> .gitignore | |
| echo "# [$parent_dir] $dir_path/.gitignore" >> .gitignore | |
| sed "s|^|$dir_path/|" "$gitignore_file" >> .gitignore | |
| done | |
| 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 origin HEAD:${GITHUB_REF_NAME} |