8000 Fix create issue script by sofide · Pull Request #2876 · python/python-docs-es · GitHub
[go: up one dir, main page]

Skip to content

Fix create issue script #2876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve issue body
  • Loading branch information
sofide committed Nov 21, 2024
commit 19150952bf8ec834653bb153f1ea5cbb4f7567d5
22 changes: 16 additions & 6 deletions scripts/create_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
from potodo.potodo import PoFileStats

PYTHON_VERSION = "3.13"
ISSUE_LABELS = [PYTHON_VERSION, "good first issue"]
PENDING_ENTRIES_FOR_GOOD_FIRST_ISSUE = 5
GOOD_FIRST_ISSUE_LABEL = "good first_issue"
ISSUE_LABELS = [PYTHON_VERSION]
ISSUE_TITLE = 'Translate `{pofilename}`'
ISSUE_BODY = '''This needs to reach 100% translated.

Expand All @@ -23,10 +25,10 @@

Current stats for `{pofilename}`:

- Fuzzy: {pofile_fuzzy}
- Percent translated: {pofile_percent_translated}%
- Entries: {pofile_entries}
- Untranslated: {pofile_untranslated}
- Total entries: {pofile_entries}
- Entries that need work: {pending_entries} - ({pofile_percent_translated}%)
- Fuzzy: {pofile_fuzzy}
- Untranslated: {pofile_untranslated}

Please, comment here if you want this file to be assigned to you and a member will assign it to you as soon as possible, so you can start working on it.

Expand Down Expand Up @@ -79,6 +81,13 @@ def issue_generator(self, pofilename):
self.check_issue_not_already_existing(pofilename)
self.check_translation_is_pending(pofile)

pending_entries = pofile.fuzzy + pofile.untranslated

if pending_entries <= PENDING_ENTRIES_FOR_GOOD_FIRST_ISSUE:
labels = ISSUE_LABELS + [GOOD_FIRST_ISSUE_LABEL]
else:
labels = ISSUE_LABELS

urlfile = pofilename.replace('.po', '.html')
title = ISSUE_TITLE.format(pofilename=pofilename)
body = ISSUE_BODY.format(
Expand All @@ -89,9 +98,10 @@ def issue_generator(self, pofilename):
pofile_percent_translated=pofile.percent_translated,
pofile_entries=pofile.entries,
pofile_untranslated=pofile.untranslated,
pending_entries=pending_entries,
)
# https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html#github.Repository.Repository.create_issue
issue = self.repo.create_issue(title=title, body=body, labels=ISSUE_LABELS)
issue = self.repo.create_issue(title=title, body=body, labels=labels)

return issue

Expand Down
0