Skip to content

Commit

Permalink
Release 0.2.4 (#74)
Browse files Browse the repository at this point in the history
* possible fix for problems with release

* add temporary test

* fix indentation

* ugly as one-liner

* that counts as indent?

* allow repo URLs without the explicit .git

* tiny typo

* Remove temporary test
  • Loading branch information
dwhswenson authored Nov 23, 2020
1 parent 6bac60a commit ba6ce9c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autorelease-gh-rel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.x"
python-version: "3.7"
- run: | # TODO: move this to an action
source ./.github/workflows/autorelease-default-env.sh
cat autorelease-env.sh >> $GITHUB_ENV
Expand Down
36 changes: 24 additions & 12 deletions autorelease/scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,14 @@ def make_logger(quiet=False):
pass

def github_url_to_owner_repo(url):
pattern = ".*github.com[\:\/]([^\/]+)\/(.*)\.git"
pattern = ".*github.com[\:\/]([^\/]+)\/(.*)"
match = re.match(pattern, url)
return match.groups()

def main():
parser = make_parser()
opts = parser.parse_args()

logger = make_logger(opts.quiet)

print(opts)

repo = git.Repo(opts.repo)
owner, name = match.groups()
if name.endswith('.git'):
name = name[:-4]
return owner, name

def get_github_info(repo):
upstream = [r for r in repo.remotes if r.name == 'upstream']
origin = [r for r in repo.remotes if r.name == 'origin']
if not upstream:
Expand All @@ -51,8 +45,26 @@ def main():
upstream = upstream[0]
origin = origin[0]

print(repo.remotes)
for remote in repo.remotes:
print(remote.url)
print(upstream.url)
print(origin.url)

(owner, name) = github_url_to_owner_repo(upstream.url)
(user, _) = github_url_to_owner_repo(origin.url)
return owner, user, name

def main():
parser = make_parser()
opts = parser.parse_args()

logger = make_logger(opts.quiet)

print(opts)

repo = git.Repo(opts.repo)
owner, user, name = get_github_info(repo)

if opts.repo_owner is not None:
owner = opts.repo_owner
Expand Down

0 comments on commit ba6ce9c

Please sign in to comment.