Skip to content

Commit

Permalink
Merge pull request #173 from slaclab/pre-release
Browse files Browse the repository at this point in the history
v2.3.0 release candidate
  • Loading branch information
ruck314 authored Mar 24, 2020
2 parents 5f3c4bd + bf0249d commit 926b1fc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
17 changes: 12 additions & 5 deletions releaseGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,19 @@ def pushRelease(cfg, relName, relData, ver, tagAttach, prev):

print("\nLogging into github....\n")

if args.token is None:
print("Enter your github token. If you do no have one you can generate it here:");
print(" https://github.com/settings/tokens");
token = input("\nGithub token: ");
else:
if args.token is not None:
print("Using github token from command line arg.")
token = args.token
else:
token = os.environ.get('GITHUB_TOKEN')

if token is None:
print("Enter your github token. If you do no have one you can generate it here:");
print(" https://github.com/settings/tokens");
print("You may set it in your environment as GITHUB_TOKEN")
token = input("\nGithub token: ");
else:
print("Using github token from user's environment.")

gh = github.Github(token)
remRepo = gh.get_repo(f'slaclab/{project}')
Expand Down
22 changes: 20 additions & 2 deletions releaseNotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ def getReleaseNotes(locRepo, remRepo, tagRange, noSort=False):
else:
entry['Jira'] = None

entry['Labels'] = None
for lbl in req.get_labels():
if entry['Labels'] is None:
entry['Labels'] = lbl.name
else:
entry['Labels'] += ', ' + lbl.name

if 'release candidate' not in req.title.lower():
records.append(entry)

Expand All @@ -94,7 +101,7 @@ def getReleaseNotes(locRepo, remRepo, tagRange, noSort=False):

md += '\n|||\n|---:|:---|\n'

for i in ['Author','Date','Pull','Branch','Jira']:
for i in ['Author','Date','Pull','Branch','Jira','Labels']:
if i in entry and entry[i] is not None:
md += f'|**{i}:**|{entry[i]}|\n'

Expand All @@ -117,6 +124,7 @@ def getReleaseNotes(locRepo, remRepo, tagRange, noSort=False):
import pyperclip
from getpass import getpass
import re
import os

import git # https://gitpython.readthedocs.io/en/stable/tutorial.html
from github import Github # https://pygithub.readthedocs.io/en/latest/introduction.html
Expand Down Expand Up @@ -174,7 +182,17 @@ def getReleaseNotes(locRepo, remRepo, tagRange, noSort=False):
project = re.compile(r'slaclab/(?P<name>.*?).git').search(url).group('name')

# Connect to the Git server
token = input("Enter your github token: ")
token = os.environ.get('GITHUB_TOKEN')

if token is None:
print("Enter your github token. If you do no have one you can generate it here:");
print(" https://github.com/settings/tokens");
print("You may set it in your environment as GITHUB_TOKEN")
token = input("\nGithub token: ");

else:
print("Using github token from user's environment.")

github = Github(token)

# Get the repo information
Expand Down

0 comments on commit 926b1fc

Please sign in to comment.