Skip to content

Commit 0822a1e

Browse files
authored
Merge pull request #5740 from nicoddemus/use-repo-env-var
Use TRAVIS_REPO_SLUG instead of hard-coding pytest-dev/pytest
2 parents fa75d81 + cb94fd3 commit 0822a1e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

scripts/publish_gh_release_notes.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
import pypandoc
2626

2727

28-
def publish_github_release(token, tag_name, body):
28+
def publish_github_release(slug, token, tag_name, body):
2929
github = github3.login(token=token)
30-
repo = github.repository("pytest-dev", "pytest")
30+
owner, repo = slug.split("/")
31+
repo = github.repository(owner, repo)
3132
return repo.create_release(tag_name=tag_name, body=body)
3233

3334

@@ -71,14 +72,22 @@ def main(argv):
7172
print("GH_RELEASE_NOTES_TOKEN not set", file=sys.stderr)
7273
return 1
7374

75+
slug = os.environ.get("TRAVIS_REPO_SLUG")
76+
if not slug:
77+
print("TRAVIS_REPO_SLUG not set", file=sys.stderr)
78+
return 1
79+
7480
rst_body = parse_changelog(tag_name)
7581
md_body = convert_rst_to_md(rst_body)
76-
if not publish_github_release(token, tag_name, md_body):
82+
if not publish_github_release(slug, token, tag_name, md_body):
7783
print("Could not publish release notes:", file=sys.stderr)
7884
print(md_body, file=sys.stderr)
7985
return 5
8086

81-
print(f"Release notes for {tag_name} published successfully")
87+
print()
88+
print(f"Release notes for {tag_name} published successfully:")
89+
print(f"https://github.com/{slug}/releases/tag/{tag_name}")
90+
print()
8291
return 0
8392

8493

0 commit comments

Comments
 (0)