Commit Graph
40 Commits
Author SHA1 Message Date
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
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
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 babcbcd04f Update most URLs to docs.github.com (#1896)
Now that GitHub have moved their documentation from
developer.github.com, we should update our links. I have also tried to
update the call strings to their new format, but since it was done via
regex, some of them may not match exactly.
2021-03-26 20:43:48 +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
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
Colby Gallup 048c8a1df2 Add support for deployment statuses (#1588)
* Added DeploymentStatus class
* Added stubs for DeploymentStatus class
* Fixed headers for DeploymentStatus.py
* Added get/list/create deployment status methods
* Added DeploymentStatus repr
* Added attribute check tests for DeploymentStatus
* Added "create deployment status" test
* Added test for Deployment.get_statuses()
* Added Deployment.get_status() method

Fixes #1586
2020-07-02 12:27:05 +10:00
Steve Kowalik 84bb69abff Drop use of shadow-cat for draft PRs (#1469) 2020-04-26 10:05:20 +08:00
Adrian Bridgett 219bde53d3 Add "get_repo_permission" to Team class (#1416)
* Add "get_repo_permission" to Team class

* second attempt:
- accept repo name or repo object
- return github.Permissions.Permissions object
- try and following CONTRIBUTING.md better

* add missing import to tests
patch replay data with permission data

* assert a specific permission rather than just the type

Fixes #1415
2020-03-13 11:01:16 +11:00
Anuj Bansal bd0211eb73 Add draft flag parameter, update tests 2020-03-07 11:42:41 +05:30
Nick Campbell 732fd26abd Support github timeline events. (#1302)
Adds support for retrieval of Github timeline events.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
2019-12-29 10:50:05 +11:00
Tim Gates baddb7193f Add support for update branch (#1317)
* Add Support for PullRequest update-branch

* Add test case

* Fix test case

* Add test data record

* Update PullRequest.py

* Update PullRequest.py

* Support py2.7

* Assert response status is 202

* black + isort
2019-12-12 20:50:25 +08:00
Wan Liuyang 6ceb9e9a15 Apply black to whole codebase (#1303) 2019-12-10 17:14:33 +08:00
Adam Baratz ec3c8d7b3b Add support for team discussions (#1246) (#1249)
* Add support for team discussions (#1246)

* Make a TeamDiscussion completeable
2019-10-31 21:19:10 +11:00
Steve Kowalik 6ad592b1b6 Correct header check for 2FA required (#1274)
Currently, we were checking for an uppercase header if GitHub was
refusing our authentication because we didn't provide a token. Requests
returns headers with all lowercase. Fix the const, and add a test for
good measure.

Fixes #1273
2019-10-25 21:01:58 +11: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
Shubham Singh b4d895eddd Adding migration api wrapper (#899)
Closes #818
2018-12-21 12:01:01 +08:00
Alice GIRARD 8ee75a282b Added support for required signatures on protected branches (#939)
Wraps the parts of the branch protection API that allows the user to require signed commits on a branch.
New methods are :
* Branch.get_required_signatures : returns true if signed commits are required
* Branch.add_required_signatures : adds the requirements for signed commits on a branch
* Branch.remove_required_signatures : removes the requirement for signed commits on a branch

It uses the API provided on this page : https://developer.github.com/v3/repos/branches/

Since this feature is in [preview](https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/) I pass the 'Accept application/vnd.github.zzzax-preview+json' header to each request.
2018-10-22 14:37:47 +08:00
h.shi 1fa25670f7 Add highlight search to search_code function (#925)
*  add highlight search to search_code function

*  add highlighting search code tests
2018-10-10 16:38:47 +08:00
Yossarian King faca4ce1c0 Add support for projects (#854)
Initial solution for [PyGithub support for projects](https://github.com/PyGithub/PyGithub/issues/606) (#606). Adds comprehensive project querying API.

Currently does not support for modifying projects, columns or cards. (I only need this interface for reporting purposes. Of course once I'm done others are more than welcome to add additional features!)

API that was integrated:
https://developer.github.com/v3/projects
https://developer.github.com/v3/projects/columns
https://developer.github.com/v3/projects/cards

Note that the Github project API is in preview mode - it requires a special header in order for requests to be processed, and the API is subject to change without notice.

## Summary
- new classes: Project, ProjectColumn, ProjectCard
- add Organization.get_projects method
- add Repository.get_projects method
- add MainClass.get_project method
- add test cases to exercise all new classes and methods and verify attributes are as expected; replay data is included, recorded (mostly) from my fork of PyGithub
- updated add_attribute script to:
  - use makeXXXAttribute API
  - be able to add to the end of the current set of properties
  - handle both Completable and NonCompletable class types correctly

## Checklist
Not to be merged until these are done:

- [x] remaining Project properties
- [x] remaining ProjectColumn properties
- [x] remaining ProjectCard properties
- [x] support for archived_state parameter when getting cards: all,archived, or not_archived
- [x] get issue from card, not just pull request ("get_content" method?)
- [x] centralize header management for "preview" access to projects API
- [x] add test for retrieving organization projects
- [x] add test for getting issue / pull request content from card
2018-09-11 13:05:16 +08:00
Steve Kowalik eb80564b01 Implement Organization.invite_user (#880)
Utilize the API preview for the organization invite system to allow
organization owners to invite outside colloborators either via passing
in the user directly, or their email address.
    
Fixes #851
2018-08-28 14:29:23 +08:00
Steve Kowalik ef16702a0d Add support for required approving review count (#888)
The GitHub API currently has a beta extension to the Branch Protection
API that allows inspection and setting of the number of required
approving reviews required for a PR to be merged. Add support for it.
2018-08-28 13:34:34 +08:00
Aaron L. Levine 7ac2a2ac97 Adding new attributes to IssueEvent (#857)
See Issue #855 

The class [IssueEvent](https://github.com/PyGithub/PyGithub/blob/master/github/IssueEvent.py) is missing a large number of attributes documented in the [API](https://developer.github.com/v3/issues/events/).

This is also commented about in #653 to a degree

27 of the tests 27 known event types have tests.

**Currently Tested using Issue #30**            
- [x] subscribed
- [x] assigned
- [x] referenced               
- [x] closed                   
- [x] labeled                  

**Currently Tested using Issue/PR #538**
- [x] merged
- [x] mentioned
- [x] review_requested

**Currently Tested using Issue/PR #857**
- [x] reopened
- [x] unassigned
- [x] unlabeled
- [x] renamed
- [x] base_ref_changed
- [x] head_ref_deleted 
- [x] head_ref_restored
- [x] milestoned
- [x] demilestoned
- [x] locked
- [x] unlocked
- [x] review_dismissed
- [x] review_request_removed
- [x] marked_as_duplicate
- [x] unmarked_as_duplicate
- [x] added_to_project       
- [x] moved_columns_in_project
- [x] removed_from_project
- [x] converted_note_to_issue - Note: this event is tied into Issue #866 

This PR is now ready to be merged
2018-08-25 00:01:29 +08:00
Wan Liuyang ae5cdb285e Refactor common header constants and custom media type 2018-08-21 15:01:23 +08:00
Wan Liuyang 3f0caa4057 Sync copyright header 2018-08-19 10:47:41 +08:00
Maarten Fonville 3aead15818 Handle HTTP 202 HEAD&GET with a retry (#791)
* Handle HTTP 202
Fixes #564
After some testing, it seems GitHub seems to be able to process the chrunching of statistics
for every repository I tested in around 2 seconds. So a delay of around 5 seconds should be
plenty to be very certain that the next try should succeed.
Another option would be to put this value lower and possibly waste an extra retry on it.

* Only re-request data if HEAD or GET (those are 'safe')
to e.g. avoid running a duplicate POST or PUT, that can change stuff on the server
Using RFC 2616 and https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html as guideline

* Fix testStatistics

* change wait time to 2 secs
2018-06-22 16:54:32 +08:00
sfdye 365a0a24d3 Apply fix_headers script to update copyright info 2018-03-17 20:06:16 +08:00
sfdye 58e1ef9ccb Fix copyright formatting 2018-03-13 22:30:47 +08:00
sfdye 020c136a40 Update doc link in copyright text 2018-03-13 22:07:38 +08:00
Wan Liuyang a32a17bf81 Fix broken Github reference link in class docstrings 2018-03-13 15:07:07 +08:00
Jakub Wilk 10a28e0654 Fix typo in a constant 2016-10-16 22:28:45 +02:00
Peter Buckley cb0cf0a680 update doc url everywhere (#420) 2016-07-12 16:38:02 -04:00
Vincent Jacques abca7a026e pep8
This is strange, maybe Cygwin's version is stricter.
No time to investigate.
2014-05-04 12:54:05 -07:00
Vincent Jacques a6b4165d6c ./manage.sh fix_headers 2013-09-06 11:39:12 +02:00
AKFish 38b137fb37 Fix line ending 2013-08-24 07:21:41 +08:00
Vincent Jacques fb7325884e Fix remarks on #189 to #193 2013-08-23 09:32:47 +02:00
Vincent Jacques 0f74e4389b Review of #189: pep8, copyrights, style, remarks
For remarks, run: git grep "#189"
They are only my first thoughts while reviewing this pull request,
and should be reviewed themselves.
2013-08-22 12:12:38 +02:00
Vincent Jacques 1787765a61 Review of #189: use dict.get
http://docs.python.org/2/library/stdtypes.html#dict.get
2013-08-22 11:41:15 +02:00
AKFish 70a7e9c83d Fix update 2013-08-22 07:45:27 +08:00
AKFish bd7abb5877 Add update() method 2013-08-21 23:01:40 +08:00