Skip to content

Commit

Permalink
Create release issue done
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Nov 23, 2024
1 parent 7b5eaaa commit 563f2c4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
51 changes: 33 additions & 18 deletions galaxy_release_util/bootstrap_history.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Little script to make HISTORY.rst more easy to format properly, lots TODO
# pull message down and embed, handle multiple, etc...

import logging
import calendar
import datetime
import os
Expand All @@ -13,12 +14,11 @@

import click
from github.PullRequest import PullRequest
from github import GithubException
from packaging.version import Version

from .cli.options import (
ClickVersion,
#next_version_option,
freeze_date_option,
galaxy_root_option,
group_options,
)
Expand Down Expand Up @@ -336,18 +336,29 @@
help="Next release version.",
)

freeze_date_option = click.option(
"--freeze-date",
type=click.DateTime(),
default=datetime.datetime.today(),
)

dry_run_option = click.option(
"--dry-run",
type=bool,
default=False,
)

log = logging.getLogger(__name__)

@click.group(help="Subcommands of this script can perform various tasks around creating Galaxy releases")
def cli():
pass


@cli.command(help="Create release checklist issue on GitHub")
@group_options(release_version_argument, next_version_option, freeze_date_option, galaxy_root_option)
def create_release_issue(release_version: Version, next_version: Version, freeze_date, galaxy_root: Path):
"""
TODO
""" # TODO ADD COMMENT

@group_options(release_version_argument, next_version_option, freeze_date_option, galaxy_root_option, dry_run_option)
def create_release_issue(release_version: Version, next_version: Version, freeze_date, galaxy_root: Path, dry_run: bool):
""" Create release publication issue."""
previous_version = _get_previous_release_version(galaxy_root, release_version)
next_version = next_version or _get_next_release_version(release_version)
assert next_version > release_version, "Next release version should be greater than release version"
Expand All @@ -358,21 +369,25 @@ def create_release_issue(release_version: Version, next_version: Version, freeze
previous_version=previous_version,
freeze_date=freeze_date,
)

release_issue_contents = RELEASE_ISSUE_TEMPLATE.safe_substitute(**release_issue_template_params)
#print(release_issue_contents)

github = github_client()
repo = github.get_repo(f"{PROJECT_OWNER}/{PROJECT_NAME}")

# TODO error: must enable github tokern !!!!!
assert token?????

release_issue = repo.create_issue(
title=f"Publication of Galaxy Release v {release_version}",
body=release_issue_contents,
)
return release_issue
if dry_run:
print(release_issue_contents)
return None
try:
release_issue = repo.create_issue(
title=f"Publication of Galaxy Release v {release_version}",
body=release_issue_contents,
)
return release_issue
except GithubException:
log.exception(
"Failed to create an issue on GitHub. You need to be authenticated to use GitHub API."
"\nSee galaxy_release_util/github_client.py"
)


@cli.command(help="Create or update release changelog")
Expand Down
12 changes: 0 additions & 12 deletions galaxy_release_util/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@
)


release_date_option = click.option(
"--release-date",
type=click.DateTime(),
)

freeze_date_option = click.option(
"--freeze-date",
type=click.DateTime(),
default=datetime.datetime.today(),
)


def group_options(*options):
def wrapper(function):
for option in reversed(options):
Expand Down

0 comments on commit 563f2c4

Please sign in to comment.