Commit Graph
183 Commits
Author SHA1 Message Date
Juan Manuel "Kang" PérezandJuan Manuel Kang Perez e296dbdbad Add missing attributes to Branch (#2512)
Co-authored-by: Juan Manuel "Kang" Perez <devel@kangmak.es>
2023-05-09 12:06:35 +02:00
Felipe Peter bab4180fd5 Add allow_update_branch option to Organization (#2465) 2023-05-08 20:16:36 +02:00
Nicolas SchweitzerandNicolas Schweitzer 5aa544a1cf Add support for Issue.state_reason #2370 (#2392)
Co-authored-by: Nicolas Schweitzer <nicolas.schweitzer@amadeus.com>
2023-05-08 08:01:05 +02:00
Mikhail f. Shiryaev 4198dbfbac Add parameters to Repository.get_workflow_runs (#2408) 2023-05-06 17:00:09 +08:00
Enrico Minack a343100084 Fix GithubIntegration using exiring jwt (#2460) 2023-05-05 14:54:52 +02:00
Enrico Minack 822fc05cd5 Add expiration argument back to GithubIntegration.create_jwt (#2439)
* Add expiration argument back to create_jwt
2023-03-17 21:40:48 +11:00
5e27c10a31 Support full GitHub app authentication (#1986)
* Support full GitHub app authentication
 Refactor GithubIntegration class and add test case for app authentication
Add permissions and repository properties in InstallationAuthorization
Set JWT_EXPIRY=60 by default in GithubIntegration constructor
* Modify existing testcases for GithubIntegration as per the framework and add missing tests
* Provide installation ID for creating the access token instead of getting the first installation
* Add optional permissions support for installation access token
* Add lock around app authentication
* Keep compatibility for importing GithubIntegration from MainClass
* Group app authentication parameters in a class

Co-authored-by: Malik Ammar Akbar <malikammar.akbar@pfizer.com>
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
2023-02-06 20:50:15 +11:00
Mikhail f. Shiryaevandgreen-green-avk 7cf3dfc18e Continue the PR #1899 (#2386)
* A property to access the `assets` field of release (#1898)

... in order to avoid extra requests.

<https://github.com/PyGithub/PyGithub/issues/1898>

* Remove comment to comply the review

* Add tests for GitRelease.assets

---------

Co-authored-by: green-green-avk <45503261+green-green-avk@users.noreply.github.com>
2023-01-31 07:44:16 +08:00
Ibrahim Hussainiandhussaiia 6c53e5442a feat: add allow_forking to Repository (#2380)
* chore(dependency): flake8 has moved to github

* feat: add allow_forking to Repository

* chore: linting

Co-authored-by: hussaiia <ibrahim.hussaini@cba.com.au>
2022-12-15 11:05:02 +08:00
Eric Nieuwland 7902351d4f Add code scanning alerts (#2227) 2022-11-09 14:59:34 +08:00
Gabriele Oliaro 3a6235b56e [WorkflowRun] - Add missing attributes (run_started_at & run_attempt), remove deprecated unicode type (#2273) 2022-10-29 11:26:24 +08:00
Marco Köpcke 0fadd6be8e Add support for repository autolink references (#2016) 2022-10-29 09:03:57 +08:00
Aleksei FedotovandAleksei Fedotov 437ff8452a Add class Artifact (#2313) (#2319)
Co-authored-by: Aleksei Fedotov <aleksei@fedotov.email>
2022-10-25 11:02:33 +08:00
b50283a7cf Create repo from template (#2090)
Co-authored-by: bagashvilit <bagashvilit@allegheny.edu>
Co-authored-by: WonjoonC <chos@allegheny.edu>
Co-authored-by: Isac Souza <isouza@daitangroup.com>
Co-authored-by: Isac Souza <isouza@daitan.com>
Co-authored-by: Liuyang Wan <tsfdye@gmail.com>
2022-10-13 09:13:31 +08:00
Liuyang Wan 7e6333da1a Fix CI (#2330) 2022-10-13 08:56:18 +08:00
xmo-odoo 001970d4a8 Improve signature of Repository.create_repo (#2118)
The docstring stated that `"*"` and `"none"` were valid values for the
organization, but neither was actually supported (unless your
organization was called `"none"`).

Remove the misleading information from the docstring, and add support
for passing in an actual `Organization` object, for better typing and
reliability properties.

Fixes #2116
2021-12-20 18:27:19 +11:00
Steve Kowalik 5c290c9a32 Fix replay data for Organization.create_secret() (#2096)
A recently merged PR added a const, which will be used when fetching
repositories. Update replay data for a test that was not included in
that change.
2021-11-01 21:19:38 +11:00
Tanner 8d1397af2f Add support for 'visibility' attribute preview for Repositories (#1872)
Expose the new 'visibility' attribute for repository objects.

Fixes #1446
2021-11-01 21:02:16 +11:00
Steve Kowalik 6452ddfeb4 Add Repository.rename_branch method (#2089)
The GitHub API exposes an endpoint to rename a branch, so we should
support calling it. Sadly, there is not enough information to add
that method to the Branch class, so expose it in the Repository object.

Fixes #1901
2021-10-24 15:21:31 +11:00
c8a945bb42 Add function to delete pending reviews on a pull request (#1897)
Add a delete method to PullRequestReview to allow dismissing them.

Fixes #1856 

Co-authored-by: bagashvilit <bagashvilit@allegheny.edu>
Co-authored-by: WonjoonC <chos@allegheny.edu>
2021-10-24 15:15:31 +11:00
Steve Kowalik f1faf941ec Cover all code paths in search_commits (#2087)
The search_commits method was only very lightly tested, meaning over
half of it was not covered. Write another test case, covering all code
paths.
2021-10-22 08:39:31 +11:00
Steve Kowalik 93b92cd2fc Correctly deal when PaginatedList's data is a dict (#2084)
When calculating totalCount for a PaginatedList, if a Link header is not
in the returned data, we use len() to calculate the number of items.
PullRequest.get_review_requests() actually returns a dictionary, which
neatly defeats this naive method. Peer inside the dictionary in this
case, and add a test case.

Fixes #2053
2021-10-20 18:49:12 +11:00
秋葉 4f00cbf2c4 Add two_factor_authentication in AuthenticatedUser. (#1972)
Fixes #1971
2021-10-19 15:07:53 +11:00
Steve Kowalik b1c8eec58f Add method to delete Workflow runs (#2078)
One piece of missing functionality is the ability to delete Workflow
Runs, which the GitHub API supports. Add a delete() method to
WorkflowRun.

Fixes #2019
2021-10-15 15:40:09 +11:00
James Simpson 53fb49882f Implement organization.cancel_invitation() (#2072)
Implement a new function cancel_invitation for github.Organization objects, allowing for
cancellation of organization invitations.
2021-10-13 16:22:54 +11:00
秋葉 6570892a79 Feat: Add html_url property in Team Class. (#1983)
Fixes: #1942
2021-10-13 15:57:07 +11:00
Marina Peresypkina bc5e5950aa Add github actions secrets to org (#2006)
Add functionality to create and delete Secrets for Organizations.
2021-10-13 15:33:18 +11:00
Steve Kowalik fcc1236870 Correct replay for Organization.create_project() test (#2075)
The just landed test case for Organization.create_project() used the
wrong Authorization headers, correct it.
2021-10-12 17:55:28 +11:00
karthik-kadajji d71c25a6d4 Add type hint for Organization.create_project() (#2032)
Organization.create_project() did not have a type hint, add one, and a test case.
2021-10-12 16:10:48 +11:00
Steve Kowalik b10dbe3989 Fix AuthenticatedUser ReplayData with parameters (#2074)
A recently merged change modified AuthenticatedUser.get_notifications()
in how it passes boolean parameters, but did not modify the replay data.
Do so now.
2021-10-11 16:39:19 +11:00
Steve Kowalik 1265747e99 Do not transform requestHeaders when logging (#1965)
Requester.__log() sanitizes the headers of the request so that
authentication details are not logged, but this has the side effect of
meaning that future requests that use the same Requester object will
fail. Usually, this is perfectly fine, since almost every method will
only make one request -- where this falls down is when we make another
after a redirect. Make a copy of the requestHeaders, and sanitize those.

Fixes #1959
2021-06-02 15:00:00 +10:00
Steve Kowalik 4faff23ce9 Implement hash for CompletableGithubObject (#1922)
Since CompletableGithubObject already uses its URL attribute to
implement equality, extend it to also use that attribute for hashing.

Fixes #1826
2021-04-26 14:24:00 +10:00
MeggyCal ad124ef481 key_id could be int on Github Enterprise (#1894)
* PublicKey.key_id can also be int, as well as str

Fixes #1878
2021-03-26 20:31:17 +11:00
MeggyCal 2c77cfad56 Adjust to Github API changes regarding emails (#1890)
Handle AuthenticatedUser.get_emails() correctly with the GitHub API changes.

Fixes #1852
2021-03-24 21:30:01 +11:00
Steve Kowalik 5aab6f5dc2 Tighten asserts for new Permission tests (#1893)
The recently merged code checking attributes on Permissions overeagerly
used assertEqual for everything, switch to the more appropriate methods.
2021-03-24 14:39:58 +11:00
karsten-wagner 76879613fa Adding attributes "maintain" and "triage" to class "Permissions" (#1810)
* Adding attributes "maintain" and "triage" to class "github.Permissions.Permissions"

* Fix for failed test due to extended attribute list

* Adding new simplistic test case for class Permissions

Fixes #1809
2021-03-24 14:27:14 +11:00
Steve Kowalik 916da53bef Re-raise the exception when failing to parse JSON (#1892)
Since GitHub has the bad manners to return bare strings for some API
endpoints, one sharp edge has been that JSON decoding errors were masked
since we wrap the string in a dictionary. However, this makes it
difficult to debug malformed JSON in replay data, so re-raise the
exception if the first character is a { or [ (IE, it's an object or
list.)
2021-03-24 13:56:54 +11:00
Sam Morgan a68577b76a Update PyJWT Version to 2.0+ (#1891)
* Update PyJWT version
* Fix `GitRelease.testUploadAssetWithName` test
  MIME type wasn't as expected

Fixes #1832
2021-03-24 10:14:35 +11:00
Steve Kowalik 3003e06501 Use right variable in both get_check_runs() (#1889)
Both CheckSuite and Commit have a get_check_runs() method that allows
filtering by a string -- the original code did not check for it, and
never added it to the query string since it checked the wrong variable.
Check the right variable and re-record the replay data.

Fixes #1843
2021-03-24 10:02:02 +11:00
Steve Kowalik 901af8c862 Remove client_id/client_secret authentication (#1888)
Authenticating via client_id and client_secret is dangerous, since they
appended to the query string, and can be easily seen from the URL.

client_id/client_secret have been deprecated since May 2020, and ignored
by GitHub since late 2020, so it's high time they were removed.
2021-03-23 14:48:47 +11:00
Steve Kowalik ddd437a7cd Export headers in GithubException (#1887)
Since the headers that led to an exception are also useful, firstly pass
them into the constructor, and then export them in a property. Test one
specific use case to make sure of coverage.

Fixes #1814
2021-03-23 13:47:05 +11:00
Steve Kowalik e0acd8f466 Test repr() for PublicKey (#1879)
The new PublicKey tests did not test the repr() method, increase
coverage by doing so.
2021-03-22 13:07:22 +11:00
Steve Kowalik 696793dea7 Add support for deleting repository secrets (#1868)
When a previous commit added support for creating secrets on repository
objects, support was not added to also remove them. Since the GitHub API
does support that, add a method to do so.
2021-03-17 16:02:57 +11:00
Chris KeatingandLiuyang Wan c90c050ef1 Adding github actions secrets (#1681)
* Fixed pre-commit issues

* Fixed mypy linting error

* Fix flake8 error

* Update PublicKey.py

* Update PublicKey.py

* Update setup.py

* Update setup.py

* Update requirements.txt

Co-authored-by: Liuyang Wan <tsfdye@gmail.com>

Co-authored-by: Liuyang Wan <tsfdye@gmail.com>
2021-03-07 05:40:52 +08:00
Yuya Nakamura 7db1b0c924 fix get_user_issues (#1842)
AuthenticatedUser.get_user_issues() calls the wrong API endpoint.

Fixes #1841
2021-03-05 15:27:34 +11:00
Steve Kowalik 290b62726f Switch all string addition to using f-strings (#1774)
Now that we no longer support Python 3.5, stop using string addition
everywhere it makes sense, and move to the best feature 3.6+ gives us,
f-strings!
2021-03-03 14:50:57 +11:00
Amador Pahim a77d4f48cb Enabling connetion pool_size definition
requests has a default connections pool of 10. Creating multiple threads
will consume from that same pool, since the underlying implementation of
the requests pool is a singletown.

Let's make the pool_size configurable, so clients can set the proper
number for their use case when running multiple threads.

Signed-off-by: Amador Pahim <apahim@redhat.com>
2021-01-08 11:55:36 +00:00
Amador Pahim aaec0a0f0f Always define the session adapter
This represents no change of behaviour, but it enables us to set more
options to the adapter.

Signed-off-by: Amador Pahim <apahim@redhat.com>
2021-01-08 11:55:36 +00:00
Steve Kowalik e113e37de1 Add pyupgrade to pre-commit configuration (#1783)
To help us switch to f-strings and other 3.6+ changes, add pyupgrade to
our pre-commit configuration to keep the codebase clean.
2020-12-15 14:07:33 +11:00
Dhruv ManilawalaandRaju Subramanian 6d501b286e Add support for Check Suites (#1764)
* Add initial support for Check Suites
* Add API call detail in CheckSuite.rerequest
* Update Accept header with general instead of preview
* Add 'get check runs' endpoint for CheckSuite with stubs
* Add create check suite endpoint with stub
* Update CheckSuite tests with creat check suite endpoint
* Add update check suites preferences endpoint
* Add repository preferences object and stub file
* Add update check suite preferences tests

Needed for #1621

Co-authored-by: Raju Subramanian <coder@mahesh.net>
2020-11-30 16:03:07 +11:00