Commit Graph
235 Commits
Author SHA1 Message Date
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
Steve Kowalik aa24030471 Switch repository secrets to using f-strings (#1867)
New code written before we switched to f-strings need to get updated to
using them, so do so.
2021-03-08 15:11:38 +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
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
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
Pascal Hofmann 197e065372 Add missing preview features of Deployment and Deployment Statuses API (#1674)
* Add missing preview features of Deployment and Deployment Statuses API
  - Enable support for deployment status states in_progress and queued
  - Add arguments production_environment and transient_environment to Repository.create_deployment()
  - Add attributes production_environment and transient_environment to Deployment
  - Use correct type in assertion for Deployment.payload
  - Fix incorrect assertion for description in Deployment.create_status()
  - Add arguments environment, environment_url, auto_inactive to Deployment.create_status()
  - Add attribute environment_url to DeploymentStatus
2020-11-30 15:47:54 +11:00
Dhruv Manilawala c77c06760e Add Support for Check Runs (#1727)
* Add CheckRun object and stub file
* Add list of check runs endpoint for Commit
* Add get check run endpoint for Repository
* Add CheckRun test file and replay data files
* Add CheckRunAnnotation object and stub file
* Add create CheckRun API endpoint to Repository
* Update and add new tests for CheckRun endpoint:
2020-11-19 14:29:04 +11:00
Victor Zeng 24251f4b0f Added support for the Self-Hosted actions runners API (#1684)
* Added data model for Self-Hosted Actions Runner

* Added function for getting self-hosted runners
2020-10-28 15:53:33 +11:00
Victor Zeng c23564ddbd Added support for Repository.get_workflow_runs parameters (#1682)
* Added support for `Repository.get_workflow_runs` parameters

* Added anchor tag to docstring link

* Tests
2020-10-28 13:37:59 +11:00
Steve Kowalik 07e29fe014 Format with new black (#1679)
Black is very opinionated, but sometimes those opinions change. Run the
new black version across the codebase, and lock down the version used by
pre-commit so we don't get surprised like this again.
2020-09-02 14:59:09 +10:00
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