Skip to content

Commit

Permalink
Merge pull request #574 from andynu/case_conflicts.py
Browse files Browse the repository at this point in the history
Add a case_conflict.py to check for case-only file conflicts.
And run the new script in 2 GitHub Actions.
  • Loading branch information
claremacrae authored Dec 19, 2022
2 parents a59210b + fcde47b commit 9d06745
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/scripts/case_conflicts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from collections import defaultdict
from glob import glob

def main() -> None:
found_conflict = False
all_markdown_paths = glob("../../*.md") + glob("../../**/*.md")

paths_by_lower_path = defaultdict(list)
for path in all_markdown_paths:
paths_by_lower_path[path.lower()].append(path)

for lower_path, original_paths in paths_by_lower_path.items():
#print(f"count={len(original_paths)} - {lower_path}")
if len(original_paths) == 1:
# No conflict.
continue

found_conflict = True
print("Conflict!")
for path in original_paths:
print(f"\t{path}")

if found_conflict:
exit(1)

if __name__ == '__main__':
main()

5 changes: 5 additions & 0 deletions .github/workflows/check_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ jobs:
run: |
cd .github/scripts
./run_markdownlint.sh
- name: Check that there are no files whose filename differs only by capitalization.
run: |
cd .github/scripts
python3 ./case_conflicts.py
1 change: 1 addition & 0 deletions .github/workflows/update_hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
run: |
cd .github/scripts
python3 ./update_releases.py --all
python3 ./case_conflicts.py
cd ../..
git add .
git commit -m "Add new plugins, themes and authors" || echo "nothing to commit"
Expand Down

0 comments on commit 9d06745

Please sign in to comment.