Skip to content

Commit ca0ceb5

Browse files
committed
Add more checks to avoid creating duplicated issues
1 parent ae1fb1f commit ca0ceb5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

scripts/create_issue.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,25 @@
1717
repo = g.get_repo('PyCampES/python-docs-es')
1818

1919

20-
issues = repo.get_issues(state='open')
20+
issues = repo.get_issues(state='all')
2121
for issue in issues:
2222
if pofilename in issue.title:
23+
24+
print(f'Skipping {pofilename}. There is a similar issue already created at {issue.html_url}')
25+
sys.exit(1)
26+
2327
msg = f'There is a similar issue already created at {issue.html_url}.\nDo you want to create it anyways? [y/N] '
2428
answer = input(msg)
2529
if answer != 'y':
2630
sys.exit(1)
2731

32+
if any([
33+
pofile.translated_nb == pofile.po_file_size,
34+
pofile.untranslated_nb == 0,
35+
]):
36+
print(f'Skipping {pofilename}. The file is 100% translated already.')
37+
sys.exit(1)
38+
2839
# https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue
2940
issue = repo.create_issue(
3041
title=f'Translate `{pofilename}`',

0 commit comments

Comments
 (0)