Skip to content

Commit b93c650

Browse files
author
Steven Silvester
authored
Merge pull request #108 from fcollonval/fix/cleanup
More Cleanup
2 parents d515b1d + c9abdaf commit b93c650

File tree

6 files changed

+18
-19
lines changed

6 files changed

+18
-19
lines changed

.github/workflows/check-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
branches: ["*"]
55
pull_request:
66
branches: ["*"]
7+
release:
8+
types: [published]
79
schedule:
810
- cron: "0 0 * * *"
911

jupyter_releaser/changelog.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,7 @@ def format_pr_entry(target, number, auth=None):
4141

4242

4343
def get_version_entry(
44-
branch,
45-
repo,
46-
version,
47-
*,
48-
since=None,
49-
until=None,
50-
auth=None,
51-
resolve_backports=False,
52-
remote="origin",
44+
branch, repo, version, *, since=None, until=None, auth=None, resolve_backports=False
5345
):
5446
"""Get a changelog for the changes since the last tag on the given branch.
5547
@@ -69,8 +61,6 @@ def get_version_entry(
6961
The GitHub authorization token
7062
resolve_backports: bool, optional
7163
Whether to resolve backports to the original PR
72-
remote: str, optional
73-
The remote target (default is origin)
7464
7565
Returns
7666
-------
@@ -80,17 +70,15 @@ def get_version_entry(
8070

8171
if not since:
8272
tags = util.run(
83-
f"git --no-pager tag --sort=-creatordate --merged {remote}/{branch}",
84-
quiet=True,
73+
f"git --no-pager tag --sort=-creatordate --merged {branch}", quiet=True
8574
)
8675
if tags:
8776
since = tags.splitlines()[0]
8877

8978
util.log(f"Getting changes to {repo} since {since} on branch {branch}...")
9079

91-
until = until or util.run(
92-
f'git --no-pager log -n 1 {remote}/{branch} --pretty=format:"%H"'
93-
)
80+
until = until or util.run(f'git --no-pager log -n 1 {branch} --pretty=format:"%H"')
81+
9482
until = until.replace("%", "")
9583

9684
md = generate_activity_md(

jupyter_releaser/lib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,9 @@ def publish_assets(dist_dir, npm_token, npm_cmd, twine_cmd, dry_run):
365365
os.environ.setdefault("TWINE_USERNAME", "__token__")
366366

367367
if len(glob(f"{dist_dir}/*.tgz")):
368-
npm.handle_npm_config(npm_token, dist_dir)
368+
npm.handle_npm_config(npm_token, os.getcwd())
369+
if npm_token:
370+
util.run("npm whoami", cwd=os.getcwd())
369371

370372
found = False
371373
for path in sorted(glob(f"{dist_dir}/*.*")):

jupyter_releaser/npm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def handle_npm_config(npm_token, dist_dir):
134134
text += f"\n{registry}:_authToken={npm_token}"
135135
if npmrc.exists():
136136
text = npmrc.read_text(encoding="utf-8") + text
137+
util.log(f"writing npm config to {npmrc}:\n{text}")
137138
npmrc.write_text(text, encoding="utf-8")
138139

139140

jupyter_releaser/tests/test_cli.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,6 @@ def wrapped(cmd, **kwargs):
647647
runner(
648648
[
649649
"publish-assets",
650-
"--npm-token",
651-
"abc",
652650
"--npm-cmd",
653651
"npm publish --dry-run",
654652
"--dist-dir",

jupyter_releaser/tests/test_functions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Copyright (c) Jupyter Development Team.
22
# Distributed under the terms of the Modified BSD License.
33
import json
4+
import os
45
import shutil
56
from pathlib import Path
67

78
import toml
89

910
from jupyter_releaser import changelog
11+
from jupyter_releaser import npm
1012
from jupyter_releaser import util
1113
from jupyter_releaser.tests import util as testutil
1214
from jupyter_releaser.util import run
@@ -108,6 +110,12 @@ def test_create_release_commit_hybrid(py_package, build_mock):
108110
assert util.normalize_path("dist/foo-0.0.2a0.tar.gz") in shas
109111

110112

113+
def test_handle_npm_config(npm_package):
114+
npm.handle_npm_config("abc", os.getcwd())
115+
text = Path(".npmrc").read_text(encoding="utf-8")
116+
assert "_authToken=abc" in text
117+
118+
111119
def test_bump_version(py_package):
112120
for spec in ["1.0.1", "1.0.1.dev1", "1.0.3a4"]:
113121
util.bump_version(spec)

0 commit comments

Comments
 (0)