Commit Graph
224 Commits
Author SHA1 Message Date
Steve Kowalik 4fb1d23f4d Add support for Workflow Runs (#1583)
To build on the previous work supporting querying Workflows for GitHub
Actions, add a class and relevant methods to support querying runs of a
workflow.
2020-06-26 20:47:42 +10:00
Steve Kowalik 3668f866e3 More precise typing for MainClass.get_user() (#1575)
Use typing.overload for MainClass.get_user() since it can return two
disparate types. Correct the docstring for it, as well as locking down
Sphinx to <3 due to built docs issue and drive-by link correction.

Fixes #1550
2020-06-24 16:21:18 +10:00
Mark Bromell f0f6ec83dd Small documentation correction in Repository.py (#1565)
Class `github.Clone.Clone` doesn't exist and should reference `github.Clones.Clones` instead.
2020-06-20 12:41:25 +10:00
Dominic Davis-Foster ce400bc770 Fixed formatting of docstrings for Repository.create_git_tag_and_release() and StatsPunchCard. (#1520) 2020-05-18 18:04:40 +10:00
Steve Kowalik 53d58d2b07 Remove Repository.topics (#1505)
The topics attribute has been replaced by Repository.get_topics(). To
reduce user confusion, delete the attribute.

Fixes #1504
2020-05-15 10:49:15 +10:00
Steve Kowalik 8727003fc8 Correct Repository.get_workflows() (#1518)
The API endpoint Repository.get_workflows() calls returns data in a list
item, not directly, leading to some head scratching when calling it
against GitHub. Re-record the replay data.
2020-05-14 16:45:01 +10:00
Max Wittig f7cc534d50 docs(repository): correct releases link (#1514) 2020-05-11 08:15:06 +08:00
Steve Kowalik a1ed7c0e2d Add support for Workflows (#1496)
To start supporting GitHub Actions, add the first part of that,
Workflow, which encapsulates a workflow over the API, along with
two methods on Repository to query them.
2020-05-05 15:49:45 +10:00
Steve Kowalik 84bb69abff Drop use of shadow-cat for draft PRs (#1469) 2020-04-26 10:05:20 +08:00
Florent Clarret d3bc6a5cd2 List matching references (#1471) 2020-04-26 10:03:36 +08:00
Chris de Graaf edcbdfdaf9 Add create_repository_dispatch (#1449) 2020-04-26 09:59:34 +08:00
ton-katsu 3ab97d6145 Add some attributes. (#1468)
* Add some attributes to Repository and Organization

* Format.

* small fix

* Add some test.
2020-04-21 11:49:32 +10:00
Alice GIRARDandLiuyang Wan 91433fe925 Type stubs for mypy (#1231)
* First attempt at stubs

* fix AuthenticatedUser.piy

* fix PullRequest.piy

* fix Authorization.piy

* fix Branch.piy

* fix Clones.piy

* fix Commit.piy

* fix CommitCombinedStatus.piy

* fix CommitComment.piy

* fix CommitStatus.piy

* fix ContentFile.piy

* fix Download.piy

* fix Event.piy

* fix File.piy

* fix Gist.piy

* fix GistComment.piy

* fix GistFile.piy

* fix GitAuthor.piy

* fix GitBlob.piy

* fix GitCommit.piy

* fix GitRef.piy

* fix GitRelease.piy

* renamed stubs into pyi files

* fix Notification

* fix Repository

* fix GitReleaseAsset

* fix GitTag

* fix GitTree

* fix GitTreeElement

* fix GithubException

* fix GithubObject

* fix GitignoreTemplate

* fix HookDescription

* fix HookResponse

* fix InputGitAuthor

* fix Installation

* fix InstallationAuthorization

* fix Invitation

* fix Issue

* fix IssueComment

* Fix random issues found while testing

* fix IssuePullRequest

* fix Label

* fix License

* fix Migration

* fix Milestone

* fix NamedUser

* fix NotificationSubject

* fix Organization

* fix PaginatedList

* fix Path

* fix Permissions

* fix Plan

* fix Project

* fix ProjectCard

* fix ProjectColumn

* fix PullRequestComment

* fix PullRequestMergeStatus

* fix PullRequestPart

* fix PullRequestReview

* fix Rate

* fix RateLimit

* fix Reaction

* fix Referrer

* fix RepositoryKey

* fix RequiredPullRequestReviews

* fix RequiredStatusChecks

* fix SourceImport

* fix Stargazer

* fix StatsCodeFrequency

* fix StatsCommitActivity

* fix StatsContributor

* fix Tag

* fix Team

* fix Topic

* fix UserKey

* fix MainClass

* fix Requester

* added stubs for View

* added stubs for Membership

* various syntax errors

* silence mypy noise

* keeping track of recent changes

* black + isort

Co-authored-by: Liuyang Wan <lwan@zendesk.com>
2020-03-22 19:33:23 +08:00
Steve Kowalik bfeacded4e Docstring for Repository.create_git_tag_and_release (#1425)
The function create_git_tag_and_release had no docstring, so it didn't
appear anywhere in our docs. Add a short one linking to the two methods
it calls.

Fixes #1402
2020-03-09 10:56:31 +11:00
Steve Kowalik 3d93ee1ce5 Add Deployments API (#1424)
Add a new class, Deployment to describe a deployment performed utilising
GitHub. Add three methods onto Repository to list them and create them.

Fixes #1117
2020-03-08 16:27:59 +11:00
Anuj Bansal bd0211eb73 Add draft flag parameter, update tests 2020-03-07 11:42:41 +05:30
Glenn McDonald 9564cd4de7 Add repo edit support for delete_branch_on_merge (#1381)
* Add repo edit support for delete_branch_on_merge

* Assert delete_branch_on_merge
2020-02-11 12:24:33 +11:00
Tim Gates ad040bafaf Fix mistake in Repository.create_fork() (#1383)
I modified #1306 to use the NotSet parameter after
it was pointed out this was more appropriate however
I did not also update the conditional.
2020-02-09 20:38:50 +11:00
Huw Jones 4ae1a1e523 Search repo issues by string label (#1379)
* Allow use of strings for labels in Repository.get_issues

* Fix unittests

* Update docstring

* Removed brackets from "list of..."
2020-02-09 16:41:33 +11:00
Steve Kowalik ead565adf8 Correct Repository.create_git_tag_and_release() (#1362)
Repository.create_git_tag_and_release() is a convience function that
creates a git tag and then a release. It was not passing the SHA1 of the
commit to the release function, resulting in incorrect releases.

Fixes #1336
2020-01-25 16:34:48 +11:00
Steve Kowalik 0e09983dca Repository.create_project() body is optional (#1359)
The POST parameters passed to the create_project API call did not
consider the body optional, and always included it. Fix up a formatting
error in the docstring for good measure.

Fixes #1357
2020-01-19 14:31:58 +10:00
Steve Kowalik b7894ea00c Drop Python 2 support (#1329)
With the Python 2 deadline gone, it's time to move with the times and
switch to Python 3 only.
2020-01-06 18:01:38 +11:00
Wan Liuyang 540a085001 Fix isort - add known first and third party 2019-12-11 00:54:59 +08:00
Wan Liuyang 88549a56df black 2019-12-10 23:13:34 +08:00
Wan Liuyang 6ceb9e9a15 Apply black to whole codebase (#1303) 2019-12-10 17:14:33 +08:00
Kevin LaFlamme f8e33620f4 Fix class used returning pull request comments (#1307)
Repository.get_pull_request_comments() was returning the wrong type.
2019-11-30 12:14:50 +11:00
Tim Gates 2ad51f352e Support for create_fork (#1306)
* Support for create_fork

http://developer.github.com/v3/repos/forks

* Add test case for create_fork

* Add param doc and fix extra line

* Specify the organization to increase line coverage

* Update test data

* Add type assert for organization param
2019-11-28 21:44:00 +11:00
Steve Kowalik 21e89ff1f8 Deprecate Repository.get_dir_contents() (#1285)
Repository.get_contents() and Repository.get_dir_contents() call the
same endpoint, with slightly different error handling, and with the
difference that get_dir_contents() throws an odd exception if you call
it with a file. get_contents() already even handles being called for a
directory anyway, so deprecate get_dir_contents(), and refactor the code
so the tests pass.

Fixes #1283
2019-11-14 22:17:34 +11:00
Steve Kowalik bc225f9d11 Encode content for {create,update}_file (#1267)
If a byte object (for Python 3) was passed into either create_file or
update_file, it was attempted to be co-erced into a bytearray, which
failed. Check for encoded content before we encode it into bytes and
then base64 encode it.

Fixes #1266
2019-10-22 21:30:34 +11:00
Adam Baratz a076508370 Stop ignoring unused imports and remove them (#1250)
* Stop ignoring unused imports and remove them

* Stop ignoring * imports
2019-10-19 16:43:14 +11:00
Olof-Joachim Frahm (欧雅福) 020fbebcaf Jump from notifications to related PRs/issues. (#1168)
* Jump from notifications to related PRs/issues.

* Add test case for jumping to related PRs/issues.

Also another method to get notifications scoped to a repository,
otherwise it's hard to keep out sensitive information from the test
cases.
2019-09-22 18:59:21 +10:00
Steve Kowalik a0f01cf9cf Remove more Python version specific code (#1193)
Remove a bunch of other call sites that behaved differently between
Python 2 and 3, massively cleaning up a few messy methods.
2019-08-28 15:24:54 +10:00
Will Li 8abd50e225 Add support to vulnerability alert and automated security fixes APIs (#1195)
* Add functions about automated security fixes and vulnerability alerts

* Refine methods and add unit test

* Add record

* Update record file  - change user name

* Add get vulnerability alert function

* Fix typo

* Create file for testCreateFile

* Add tests

* Add unit test

* Simplify assert statement
2019-08-08 12:24:33 +10:00
Steve Kowalik 7ddb657d47 Delete Legacy submodule (#1192)
Since the only part of the Legacy submodule that is used and tested is
the transform issue function, refactor it into a Repository method and
delete it.
2019-08-06 15:16:07 +10:00
Steve Kowalik f93207b4ca Run flake8 in Travis (#1163)
Clean up a few errors I missed, ignore another, and configure flake8 using
a config file to ignore certain errors. The next step would be to remove
the F* ignores.
2019-08-05 15:03:10 +10:00
Steve Kowalik dc2f2ad8cb Switch to using six (#1189)
With the Python 2.7 deadline fast approaching, modernize the codebase
making use of the modernize module to switch to using six, as well as
other upcoming features, such as absolute imports . Stop using 2to3
for Travis, yay!
2019-08-05 14:06:19 +10:00
Steve Kowalik f1ae7200ba Update Repository.update_file() docstring (#1186)
The docstring for Repository.update_file() insisted that content be
base64 encoded, which is not quite correct, update it.

Closes #1069
2019-08-05 09:14:06 +10:00
Steve Kowalik 57af1e0526 Add Repository methods for pending invitations (#1159)
Make a start on implementing more of the invitations API, by adding
methods to Repository to list and remove pending invitations.

Closes #1120
2019-07-03 14:48:30 +08:00
Steve Kowalik 828b53b756 Silence more flake8 errors (#1160)
Make more whitespace changes to silence flake8 errors under the github
directory only.
2019-07-02 17:55:04 +08:00
Steve Kowalik 102c820806 Handle a path of / in Repository.get_contents() (#1070)
The path requested in Repository.get_contents() is appended to the URL,
so the root path should be requested with the empty string. If path is
'/', set it to the empty string. Copy the replay data from the original
test, since it is identical.

Drive-by renaming the test to include the missing 's'.

Closes #1059
2019-05-22 15:10:27 +08:00
Wan Liuyang 3d43e9c0e6 update doc, fix #1123 2019-05-21 10:02:14 +08:00
Wan Liuyang 01737a13f8 Merge get_file_contents with get_contents 2019-05-07 10:47:22 +08:00
Alex 293846bee3 Add url parameter to include anonymous contributors in get_contributors() (#1075)
Add the anon parameter missing from get_contributors() so anonymous contributors can be included in results as specified in the [Github REST API Reference](https://developer.github.com/v3/repos/#list-contributors).
2019-04-05 13:51:40 +08:00
Benoit Latinier 1c0fd97d7d Add "create repository project" and "create project column" methods (#995)
Added the two methods:
 - Create a project for a given repo
 - Create a column for a given project 

Tests are basics but done :)
2018-12-20 10:48:54 +08:00
Justin Kufro a433a2fe3d Traffic Endpoints Support (#977)
Added support for the traffic endpoints found at https://developer.github.com/v3/repos/traffic/.

We added four functions to the Repository class (one for each of the endpoints) with corresponding unit tests. 

Fixes #926
2018-12-05 09:54:31 +08:00
Philip May 048af7551f get_issues documentation for state (#961)
Closes #835
2018-11-20 10:13:04 +08:00
Vinay Hegde 5687226b47 Ability to filter repository collaborators (#938)
## Changes
- Add `affiliation` parameter to `get_collaborators()` and use it to filter collaborators through the API
- Resolves #937


PS: Would have loved to add a simple test for this but there seems to be a problem on my end using OAuth as I'm just not able to authenticate to the API during tests.
2018-10-22 07:26:20 +08:00
Alice GIRARD 0a10d7cdf0 Mark notification as read (#932)
Wraps the parts of the notification API that allows the user to mark notifications as read.
New methods are : 
 
- Notification.mark_as_read : marks a single notification thread as read
- Repository.mark_notifications_as_read : marks all the notifications for a given repository as read
- AuthenticatedUser.mark_notifications_as_read : marks all the notifications as read

Aims to fix : https://github.com/PyGithub/PyGithub/issues/571 and simply uses the APIs described on this page : https://developer.github.com/enterprise/11.10.340/v3/activity/notifications/

A weird thing I noticed doing this is that Repository.notifications_url doesn't seem to be usable directly. I used Repository.url + "/notifications" instead.
2018-10-19 07:24:45 +08:00
AetherDeity ee9f098d91 Add a trailing slash to URL when updating or deleting a file (tests fixed) (#931)
* Add a trailing slash to URL when updating or deleting a file.

* Update test files to match new create/update/delete_file Repo methods

* Add trailing slash to get_contents() method

* update tests

* add missing slash in get_dir_contents

* add example usage

* remove dup slashes in tests

* clarify example comments
2018-10-17 08:21:17 +08:00
Jacopo Notarstefano 7286eec0e0 Fix Repository.edit (#904)
Allows to pass falsy values to the new arguments introduced in #844.

Closes #903
2018-09-16 20:00:20 +08:00