-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add support to generate release notes #3022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
68d4a5d
Add release notes template to main branch
mball-agathos 1a6e8bc
add support for generate_release_notes
mball-agathos 2f9d2a6
Merge branch 'PyGithub:main' into main
mball-agathos 424eb89
Merge branch 'main' into issue_2794
mball-agathos e27a5ea
Merge branch 'PyGithub:main' into main
mball-agathos bfb8fa4
Merge remote-tracking branch 'origin/main' into issue_2794
mball-agathos 4c5739a
Update github/Repository.py from reviewer suggestion
mball-agathos 7684e44
Add description to test_release_notes.yml
mball-agathos a225374
rename jacquev6 to PyGithub
mball-agathos 5a17934
Merge branch 'main' into issue_2794
EnricoMi 88ea15d
Fix test replay data authentication
EnricoMi 3167fd7
Add "make_latest" to test replay data required by main branch changes
EnricoMi 5ca7320
Fix path to config file in test replay data
EnricoMi 9ff1cca
Add OpenAPI schema
EnricoMi 5f2b306
Run black to reformat files
mball-agathos 2e685ce
Merge branch 'main' into issue_2794
EnricoMi 1784f77
Merge branch 'PyGithub:main' into issue_2794
mball-agathos 84257d7
Fix attribute ordering in GeneratedReleaseNotes.py
mball-agathos be2cc7e
Fix typo in _useAttributes method of GeneratedReleaseNotes
mball-agathos e9e068d
Fix assertions
EnricoMi 7c65abf
Minor cleanup, no functional change
EnricoMi 30b203c
Fix import and linting
EnricoMi 78c2a2c
Fix schema annotation
EnricoMi c6b0835
Revert empty line before schema annotation
EnricoMi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import Any | ||
|
|
||
| from github.GithubObject import ( | ||
| Attribute, | ||
| NonCompletableGithubObject, | ||
| NotSet, | ||
| ) | ||
|
|
||
|
|
||
| class GeneratedReleaseNotes(NonCompletableGithubObject): | ||
| """ | ||
| This class represents the release notes generated by the release/generate-notes REST API endpoint. | ||
|
|
||
| The reference can be found here: | ||
| https://docs.github.com/en/rest/releases/releases#generate-release-notes-content-for-a-release | ||
|
|
||
| The OpenAPI schema can be found at | ||
| - /components/schemas/release-notes-content | ||
|
EnricoMi marked this conversation as resolved.
|
||
|
|
||
| """ | ||
|
|
||
| def _initAttributes(self) -> None: | ||
| self._body: Attribute[str] = NotSet | ||
| self._name: Attribute[str] = NotSet | ||
|
|
||
| def __repr__(self) -> str: | ||
| return self.get__repr__({"name": self._name.value, "body": self._body.value}) | ||
|
|
||
| @property | ||
| def body(self) -> str: | ||
| return self._body.value | ||
|
|
||
| @property | ||
| def name(self) -> str: | ||
| return self._name.value | ||
|
|
||
| def _useAttributes(self, attributes: dict[str, Any]) -> None: | ||
| if "body" in attributes: | ||
| self._body = self._makeStringAttribute(attributes["body"]) | ||
| if "name" in attributes: | ||
| self._name = self._makeStringAttribute(attributes["name"]) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| https | ||
| POST | ||
| api.github.com | ||
| None | ||
| /repos/PyGithub/PyGithub/releases/generate-notes | ||
| {'Authorization': 'token private_token_removed', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'} | ||
| {"tag_name": "vX.Y.Z-by-PyGithub-acctest"} | ||
| 200 | ||
| [('Date', 'Sun, 18 Aug 2024 23:56:45 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"f05115701836368bcab805d829f1453234af1eea7b25bf97c3effa382838f562"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'repo'), ('github-authentication-token-expiration', '2024-11-14 21:03:22 UTC'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('x-github-api-version-selected', '2022-11-28'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4982'), ('X-RateLimit-Reset', '1724025644'), ('X-RateLimit-Used', '18'), ('X-RateLimit-Resource', 'core'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('Transfer-Encoding', 'chunked'), ('X-GitHub-Request-Id', '86EA:313F29:56B6E84:A55D123:66C28A3C'), ('Server', 'github.com')] | ||
| {"name":"vX.Y.Z-by-PyGithub-acctest","body":"**Full Changelog**: https://github.com/PyGithub/PyGithub/commits/vX.Y.Z-by-PyGithub-acctest"} |
21 changes: 21 additions & 0 deletions
21
tests/ReplayData/Repository.testGenerateReleaseNotesWithAllArguments.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| https | ||
| POST | ||
| api.github.com | ||
| None | ||
| /repos/PyGithub/PyGithub/releases | ||
| {'Authorization': 'token private_token_removed', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'} | ||
| {"tag_name": "vX.Y.Z-by-PyGithub-acctest-previous", "draft": false, "prerelease": false, "generate_release_notes": false, "name": "vX.Y.Z: PyGithub acctest", "body": "This release is created by PyGithub", "make_latest": "true"} | ||
| 201 | ||
| [('Date', 'Mon, 19 Aug 2024 00:34:07 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '1900'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With'), ('ETag', '"060006433f9b7748cbf7198d4f0d820482591704be702c1169dd21489da95c5d"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'repo'), ('github-authentication-token-expiration', '2024-11-14 21:03:22 UTC'), ('Location', 'https://api.github.com/repos/PyGithub/PyGithub/releases/170779796'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('x-github-api-version-selected', '2022-11-28'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4965'), ('X-RateLimit-Reset', '1724029435'), ('X-RateLimit-Used', '35'), ('X-RateLimit-Resource', 'core'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('X-GitHub-Request-Id', 'D6C0:2B9908:1D4A719:37A4849:66C292FE'), ('Server', 'github.com')] | ||
| {"url":"https://api.github.com/repos/PyGithub/PyGithub/releases/170779796","assets_url":"https://api.github.com/repos/PyGithub/PyGithub/releases/170779796/assets","upload_url":"https://uploads.github.com/repos/PyGithub/PyGithub/releases/170779796/assets{?name,label}","html_url":"https://github.com/PyGithub/PyGithub/releases/tag/vX.Y.Z-by-PyGithub-acctest-previous","id":170779796,"author":{"login":"PyGithub","id":96152357,"node_id":"U_kgDOBbsrJQ","avatar_url":"https://avatars.githubusercontent.com/u/96152357?v=4","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"User","site_admin":false},"node_id":"RE_kwDOMlKsTM4KLeSU","tag_name":"vX.Y.Z-by-PyGithub-acctest-previous","target_commitish":"main","name":"vX.Y.Z: PyGithub acctest","draft":false,"prerelease":false,"created_at":"2024-08-19T00:25:59Z","published_at":"2024-08-19T00:34:06Z","assets":[],"tarball_url":"https://api.github.com/repos/PyGithub/PyGithub/tarball/vX.Y.Z-by-PyGithub-acctest-previous","zipball_url":"https://api.github.com/repos/PyGithub/PyGithub/zipball/vX.Y.Z-by-PyGithub-acctest-previous","body":"This release is created by PyGithub"} | ||
|
|
||
| https | ||
| POST | ||
| api.github.com | ||
| None | ||
| /repos/PyGithub/PyGithub/releases/generate-notes | ||
| {'Authorization': 'token private_token_removed', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'} | ||
| {"tag_name": "vX.Y.Z-by-PyGithub-acctest", "previous_tag_name": "vX.Y.Z-by-PyGithub-acctest-previous", "target_commitish": "main", "configuration_file_path": "tests/test_release_notes.yml"} | ||
| 200 | ||
| [('Date', 'Mon, 19 Aug 2024 00:34:07 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"9cdecc62d8152adc4ab619d18dd9f194f4f76d5dba91ba53c92c9def3856f620"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'repo'), ('github-authentication-token-expiration', '2024-11-14 21:03:22 UTC'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('x-github-api-version-selected', '2022-11-28'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4964'), ('X-RateLimit-Reset', '1724029435'), ('X-RateLimit-Used', '36'), ('X-RateLimit-Resource', 'core'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('Transfer-Encoding', 'chunked'), ('X-GitHub-Request-Id', 'D6C4:4388A:1BF3BE3:3510B09:66C292FF'), ('Server', 'github.com')] | ||
| {"name":"vX.Y.Z-by-PyGithub-acctest","body":"<!-- Release notes generated using configuration in tests/test_release_notes.yml at main -->\n\n\n\n**Full Changelog**: https://github.com/PyGithub/PyGithub/compare/vX.Y.Z-by-PyGithub-acctest-previous...vX.Y.Z-by-PyGithub-acctest"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # This file is needed for generating release notes for the Repository::testGenerateReleaseNotesWithAllArguments test | ||
| # See https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes | ||
|
|
||
| # This is used to generate the ReplayData as used by Repository::testGenerateReleaseNotesWithAllArguments. | ||
| # If you need to regenerate this ReplayData files, you will need to copy this yaml file | ||
| # into the `.github` directory on the main branch of your forked repository. | ||
| # The GitHub API expects to see this file in the `.github` directory when generating release notes. | ||
|
|
||
| changelog: | ||
| categories: | ||
| - title: Features | ||
| labels: | ||
| - '*' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.