Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #256 from jpopelka/doc-refresh_interval
Browse files Browse the repository at this point in the history
refresh_interval related changes
  • Loading branch information
jpopelka authored Jan 16, 2020
2 parents e725fb6 + 3097b1f commit 888113e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Here are the `conf.yaml` configuration options:
| `github_app_installation_id` | Installation ID (a number) of the Github app. | No |
| `github_app_id` | ID (a number) of the Github app. | No |
| `github_app_cert_path` | Path to a certificate which Github provides as an auth mechanism for Github apps. | No |
| `refresh_interval` | Time in seconds between checks on repository. Default is 180 | No |
| `refresh_interval` | Time in seconds between checks on repository. If not provided, run only once and exit. | No |
| `clone_url` | URL used to clone your Github repository. By default, `https` variant is used. | No |
| `gitchangelog` | Whether to use gitchangelog to generate change logs. False by default. | No |

Expand Down Expand Up @@ -214,4 +214,4 @@ If you are interested in making contribution to release-bot project, please read
## Logo design
Created by `Marián Mrva` - [@surfer19](https://github.com/surfer19)
Created by `Marián Mrva` - [@surfer19](https://github.com/surfer19)
2 changes: 1 addition & 1 deletion release_bot/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self):
self.github_username = ''
self.pagure_token = ''
self.pagure_username = ''
self.refresh_interval = 3 * 60
self.refresh_interval = None
self.debug = False
self.configuration = ''
self.logger = None
Expand Down
5 changes: 3 additions & 2 deletions release_bot/init_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
output_engine = mustache("markdown.tpl")
"""


class Init:
"""
Creates all of the required configuration script required for the ReleaseBot
Expand All @@ -56,7 +57,7 @@ def __init__(self):
'repository_name': '<repository_name>',
'repository_owner': '<owner_of_repository>',
'github_token': '<your_github_token>',
'refresh_interval': '180',
'refresh_interval': None,
'github_username': '<your_github_username>',
'gitchangelog': False,
}
Expand Down Expand Up @@ -121,7 +122,7 @@ def create_conf(self, silent):
refresh_interval = "dummy"
while not (refresh_interval.isdigit() or refresh_interval == ""):
refresh_interval = input("""In how many seconds would you like the
bot to check for updates (Default 180):""")
bot to recheck for updates (Default: don't recheck and exit):""")
if refresh_interval > 0:
self.conf['refresh_interval'] = int(refresh_interval)
else:
Expand Down
15 changes: 8 additions & 7 deletions release_bot/releasebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ def release_handler(success):
try:
latest_release = self.github.latest_release()
except ReleaseException as exc:
raise ReleaseException(f"Failed getting latest {self.git_service.name} release (zip).\n{exc}")
raise ReleaseException(
f"Failed getting latest {self.git_service.name} release (zip).\n{exc}")

if Version.coerce(latest_release) >= Version.coerce(self.new_release.version):
self.logger.info(
Expand Down Expand Up @@ -257,7 +258,7 @@ def release_handler(success):
latest_pypi = self.pypi.latest_version()
if Version.coerce(latest_pypi) >= Version.coerce(self.new_release.version):
msg = f"{self.conf.pypi_project}-{self.new_release.version} " \
f"or higher version has already been released on PyPi"
f"or higher version has already been released on PyPi"
self.logger.info(msg)
return False
self.git.fetch_tags()
Expand Down Expand Up @@ -304,14 +305,14 @@ def run(self):
except ReleaseException as exc:
self.logger.error(exc)

msg = '\n'.join(self.github.comment)
self.project.pr_comment(self.new_release.pr_number, msg)
self.github.comment = [] # clean up
if self.github.comment:
msg = '\n'.join(self.github.comment)
self.project.pr_comment(self.new_release.pr_number, msg)
self.github.comment = [] # clean up

if not self.conf.refresh_interval:
self.logger.debug(
"Refresh interval has not been provided."
"Reconciliation finished."
"Refresh interval has not been provided. Reconciliation finished."
)
break
self.logger.debug(f"Done. Going to sleep for {self.conf.refresh_interval}s")
Expand Down

0 comments on commit 888113e

Please sign in to comment.