|
25 | 25 | import pypandoc
|
26 | 26 |
|
27 | 27 |
|
28 |
| -def publish_github_release(token, tag_name, body): |
| 28 | +def publish_github_release(slug, token, tag_name, body): |
29 | 29 | github = github3.login(token=token)
|
30 |
| - repo = github.repository("pytest-dev", "pytest") |
| 30 | + owner, repo = slug.split("/") |
| 31 | + repo = github.repository(owner, repo) |
31 | 32 | return repo.create_release(tag_name=tag_name, body=body)
|
32 | 33 |
|
33 | 34 |
|
@@ -71,14 +72,19 @@ def main(argv):
|
71 | 72 | print("GH_RELEASE_NOTES_TOKEN not set", file=sys.stderr)
|
72 | 73 | return 1
|
73 | 74 |
|
| 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 | + |
74 | 80 | rst_body = parse_changelog(tag_name)
|
75 | 81 | 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): |
77 | 83 | print("Could not publish release notes:", file=sys.stderr)
|
78 | 84 | print(md_body, file=sys.stderr)
|
79 | 85 | return 5
|
80 | 86 |
|
81 |
| - print(f"Release notes for {tag_name} published successfully") |
| 87 | + print(f"Release notes for {tag_name} published successfully to {slug}") |
82 | 88 | return 0
|
83 | 89 |
|
84 | 90 |
|
|
0 commit comments