Skip to content
This repository was archived by the owner on Mar 16, 2023. It is now read-only.

Commit a8aafa4

Browse files
authored
ci: adding gitignore check (googleapis#8560)
* ci: added gitignore check * fix: fixed gitignore
1 parent 00a6d87 commit a8aafa4

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

.github/workflows/generated_files_sync.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,27 @@ jobs:
9595
bash generation/update_owlbot_postprocessor_config.sh
9696
- name: Fail if there's any difference
9797
run: git --no-pager diff --exit-code
98+
99+
gitignore_correctness:
100+
name: Generated files should not match gitignore
101+
runs-on: ubuntu-latest
102+
steps:
103+
- uses: actions/checkout@v3
104+
- name: checking any files matching gitignore
105+
# By default, GitHub Actions's bash has '-e' option to fail immediately
106+
# upon non-zero exit code. Not using it here to catch the exit code 1.
107+
shell: /usr/bin/bash --noprofile --norc -o pipefail {0}
108+
run: |
109+
find . -type f -name '*.java' -not -path './.git/*' \
110+
|git check-ignore --no-index --verbose --stdin
111+
# https://git-scm.com/docs/git-check-ignore returns 1 when there's no
112+
# matching files with the gitignore file.
113+
# "--no-index" is needed to check against tracked files.
114+
if [ "$?" == 1 ]; then
115+
echo "No matching files. Good."
116+
exit 0
117+
else
118+
echo "There are gitignore matching files. Please adjust .gitignore."
119+
exit 1
120+
fi
121+

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ nosetests.xml
4848
.DS_Store
4949
.classpath
5050

51-
# Built documentation
52-
docs/
53-
5451
# API key file containing value of GOOGLE_API_KEY for integration tests
5552
api_key
5653

0 commit comments

Comments
 (0)