Update dependencies
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
1cb2d70546
commit
f0aaf20998
707 changed files with 142158 additions and 9967 deletions
36
vendor/github.com/google/go-github/v60/github/orgs_personal_access_tokens.go
generated
vendored
36
vendor/github.com/google/go-github/v60/github/orgs_personal_access_tokens.go
generated
vendored
|
|
@ -1,36 +0,0 @@
|
|||
// Copyright 2023 The go-github AUTHORS. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ReviewPersonalAccessTokenRequestOptions specifies the parameters to the ReviewPersonalAccessTokenRequest method.
|
||||
type ReviewPersonalAccessTokenRequestOptions struct {
|
||||
Action string `json:"action"`
|
||||
Reason *string `json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// ReviewPersonalAccessTokenRequest approves or denies a pending request to access organization resources via a fine-grained personal access token.
|
||||
// Only GitHub Apps can call this API, using the `organization_personal_access_token_requests: write` permission.
|
||||
// `action` can be one of `approve` or `deny`.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/personal-access-token-requests/{pat_request_id}
|
||||
func (s *OrganizationsService) ReviewPersonalAccessTokenRequest(ctx context.Context, org string, requestID int64, opts ReviewPersonalAccessTokenRequestOptions) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/personal-access-token-requests/%v", org, requestID)
|
||||
|
||||
req, err := s.client.NewRequest(http.MethodPost, u, &opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
|
@ -13,7 +13,10 @@
|
|||
413x <dedifferentiator@gmail.com>
|
||||
6543 <6543@obermui.de>
|
||||
Abed Kibbe <abed.kibbe@gmail.com>
|
||||
Abhijit Hota <abhihota025@gmail.com>
|
||||
Abhinav Gupta <mail@abhinavg.net>
|
||||
abhishek <abhishek@exaforce.com>
|
||||
Abhishek Sharma <abhishekbiyala@gmail.com>
|
||||
Abhishek Veeramalla <abhishek.veeramalla@gmail.com>
|
||||
aboy <b1011211@gmail.com>
|
||||
Adam Kohring <ajkohring@gmail.com>
|
||||
|
|
@ -35,19 +38,24 @@ Alex Orr <Alexorr.CSE@gmail.com>
|
|||
Alex Su <alexsu@17.media>
|
||||
Alex Unger <zyxancf@gmail.com>
|
||||
Alexander Harkness <me@bearbin.net>
|
||||
Alexey Alekhin <laughedelic@gmail.com>
|
||||
Alexis Gauthiez <alexis.gauthiez@gmail.com>
|
||||
Ali Farooq <ali.farooq0@pm.me>
|
||||
Alin Balutoiu <alinbalutoiu@gmail.com>
|
||||
Allan Guwatudde <guwats10@gmail.com>
|
||||
Allen Sun <shlallen1990@gmail.com>
|
||||
Amey Sakhadeo <me@ameyms.com>
|
||||
Anders Janmyr <anders@janmyr.com>
|
||||
Andreas Deininger <andreas@deininger.net>
|
||||
Andreas Garnæs <https://github.com/andreas>
|
||||
Andrew Ryabchun <aryabchun@mail.ua>
|
||||
Andrew Svoboda <svoboda.andrew@gmail.com>
|
||||
Andriyun <andriy.yun@gmail.com>
|
||||
Andy Grunwald <andygrunwald@gmail.com>
|
||||
Andy Hume <andyhume@gmail.com>
|
||||
Andy Lindeman <andy@lindeman.io>
|
||||
angie pinilla <angelinepinilla@gmail.com>
|
||||
Anish Rajan <anishrajan2708@gmail.com>
|
||||
anjanashenoy <anjanashenoy1@gmail.com>
|
||||
Anshuman Bhartiya <anshuman.bhartiya@gmail.com>
|
||||
Antoine <antoine.tu@mail.mcgill.ca>
|
||||
|
|
@ -59,6 +67,7 @@ aprp <doelaudi@gmail.com>
|
|||
apurwaj2 <apurwaj2@gmail.com>
|
||||
Aravind <aravindkp@outlook.in>
|
||||
Arda Kuyumcu <kuyumcuarda@gmail.com>
|
||||
Ary <arylmoraesn@hotmail.com>
|
||||
Arıl Bozoluk <arilbozoluk@hotmail.com>
|
||||
Asier Marruedo <asiermarruedo@gmail.com>
|
||||
Austin Burdine <acburdine@gmail.com>
|
||||
|
|
@ -66,9 +75,11 @@ Austin Dizzy <dizzy@wow.com>
|
|||
Azuka Okuleye <azuka@zatechcorp.com>
|
||||
Ben Batha <bhbatha@gmail.com>
|
||||
Benjamen Keroack <benjamen@dollarshaveclub.com>
|
||||
Benjamin Nater <benjamin@nater.net>
|
||||
Berkay Tacyildiz <berkaytacyildiz@gmail.com>
|
||||
Beshr Kayali <beshrkayali@gmail.com>
|
||||
Beyang Liu <beyang.liu@gmail.com>
|
||||
billnapier <napier@pobox.com>
|
||||
Billy Keyes <bluekeyes@gmail.com>
|
||||
Billy Lynch <wlynch92@gmail.com>
|
||||
Bingtan Lu <lubingtan@126.com>
|
||||
|
|
@ -93,6 +104,7 @@ Cami Diez <diezcami@gmail.com>
|
|||
Carl Johnson <me@carlmjohnson.net>
|
||||
Carlos Alexandro Becker <caarlos0@gmail.com>
|
||||
Carlos Tadeu Panato Junior <ctadeu@gmail.com>
|
||||
Casey <casey.duquette@snapchat.com>
|
||||
ChandanChainani <chainanichan@gmail.com>
|
||||
chandresh-pancholi <chandreshpancholi007@gmail.com>
|
||||
Charles Fenwick Elliott <Charles@FenwickElliott.io>
|
||||
|
|
@ -109,6 +121,7 @@ Christian Muehlhaeuser <muesli@gmail.com>
|
|||
Christoph Jerolimov <jerolimov@gmail.com>
|
||||
Christoph Sassenberg <defsprite@gmail.com>
|
||||
CI Monk <ci-monk@protonmail.com>
|
||||
Clemens W <Clemens.wijnekus@nordnet.se>
|
||||
Colin Misare <github.com/cmisare>
|
||||
Craig Gumbley <craiggumbley@gmail.com>
|
||||
Craig Peterson <cpeterson@stackoverflow.com>
|
||||
|
|
@ -137,6 +150,7 @@ DeviousLab <deviouslab@gmail.com>
|
|||
Dhi Aurrahman <diorahman@rockybars.com>
|
||||
Diego Lapiduz <diego.lapiduz@cfpb.gov>
|
||||
Diogo Vilela <be0x74a@gmail.com>
|
||||
Dion Gionet Mallet <dionmallet@hotmail.com>
|
||||
Dmitri Shuralyov <shurcooL@gmail.com>
|
||||
dmnlk <seikima2demon@gmail.com>
|
||||
Don Petersen <don@donpetersen.net>
|
||||
|
|
@ -149,9 +163,12 @@ Eli Uriegas <seemethere101@gmail.com>
|
|||
Elliott Beach <elliott2.71828@gmail.com>
|
||||
Emerson Wood <emersonwood94@gmail.com>
|
||||
Emil V <emil.vaagland@schibsted.com>
|
||||
Emma Sax <esselbach_briley@simplelogin.com>
|
||||
Eng Zer Jun <engzerjun@gmail.com>
|
||||
Enrico Candino <enrico.candino@gmail.com>
|
||||
eperm <staffordworrell@gmail.com>
|
||||
Erick Fejta <erick@fejta.com>
|
||||
Erik Elkins <erik.elkins@outlook.com>
|
||||
Erik Nobel <hendrik.nobel@transferwise.com>
|
||||
erwinvaneyk <erwinvaneyk@gmail.com>
|
||||
Evan Anderson <evan.k.anderson@gmail.com>
|
||||
|
|
@ -163,6 +180,7 @@ Federico Di Pierro <nierro92@gmail.com>
|
|||
Felix Geisendörfer <felix@debuggable.com>
|
||||
Filippo Valsorda <hi@filippo.io>
|
||||
Florian Forster <ff@octo.it>
|
||||
Florian Maier <florianmaier101178@gmail.com>
|
||||
Florian Wagner <h2floh@github.com>
|
||||
Francesc Gil <xescugil@gmail.com>
|
||||
Francis <hello@francismakes.com>
|
||||
|
|
@ -178,6 +196,7 @@ Glen Mailer <glenjamin@gmail.com>
|
|||
Gnahz <p@oath.pl>
|
||||
Google Inc.
|
||||
Grachev Mikhail <work@mgrachev.com>
|
||||
Gregory Oschwald <oschwald@gmail.com>
|
||||
griffin_stewie <panterathefamilyguy@gmail.com>
|
||||
guangwu <guoguangwu@magic-shield.com>
|
||||
Guillaume Jacquet <guillaume.jacquet@gmail.com>
|
||||
|
|
@ -202,6 +221,7 @@ ishan upadhyay <ishanupadhyay412@gmail.com>
|
|||
isqua <isqua@isqua.ru>
|
||||
Jacob Valdemar <jan@lunar.app>
|
||||
Jake Krammer <jake.krammer1@gmail.com>
|
||||
Jake Scaltreto <jake.scaltreto@circle.com>
|
||||
Jake White <jake@jwhite.network>
|
||||
Jameel Haffejee <RC1140@republiccommandos.co.za>
|
||||
James Bowes <jbowes@repl.ca>
|
||||
|
|
@ -210,6 +230,7 @@ James Loh <github@jloh.co>
|
|||
James Maguire <jvm986@gmail.com>
|
||||
James Turley <jamesturley1905@googlemail.com>
|
||||
Jamie West <jamieianwest@hotmail.com>
|
||||
Jan Guth <Jan.Guth@gmail.com>
|
||||
Jan Kosecki <jan.kosecki91@gmail.com>
|
||||
Jan Švábík <jansvabik@jansvabik.cz>
|
||||
Jason Field <Jason@avon-lea.co.uk>
|
||||
|
|
@ -224,6 +245,7 @@ Jihoon Chung <j.c@navercorp.com>
|
|||
Jille Timmermans <jille@quis.cx>
|
||||
Jimmi Dyson <jimmidyson@gmail.com>
|
||||
Joan Saum <joan.saum@epitech.eu>
|
||||
JoannaaKL <joannaakl@github.com>
|
||||
Joe Tsai <joetsai@digital-static.net>
|
||||
John Barton <jrbarton@gmail.com>
|
||||
John Engelman <john.r.engelman@gmail.com>
|
||||
|
|
@ -232,6 +254,7 @@ John Liu <john.liu@mongodb.com>
|
|||
Jordan Brockopp <jdbro94@gmail.com>
|
||||
Jordan Burandt <jordanburandt@gmail.com>
|
||||
Jordan Sussman <jordansail22@gmail.com>
|
||||
Jorge Ferrero <jorgeferrerolinacero@gmail.com>
|
||||
Jorge Gómez Reus <j-g1996@live.com>
|
||||
Joshua Bezaleel Abednego <joshua.bezaleel@gmail.com>
|
||||
João Cerqueira <joao@cerqueira.io>
|
||||
|
|
@ -240,6 +263,7 @@ jpbelanger-mtl <jp.belanger@gmail.com>
|
|||
Juan <juan.rios.28@gmail.com>
|
||||
Juan Basso <jrbasso@gmail.com>
|
||||
Julien Garcia Gonzalez <garciagonzalez.julien@gmail.com>
|
||||
Julien Midedji <Julien.Midedji@gmail.com>
|
||||
Julien Rostand <jrostand@users.noreply.github.com>
|
||||
Junya Kono <junya03dance@gmail.com>
|
||||
Justin Abrahms <justin@abrah.ms>
|
||||
|
|
@ -257,6 +281,7 @@ Kevin Burke <kev@inburke.com>
|
|||
Kevin Wang <kwangsan@gmail.com>
|
||||
Kevin Zhao <kzhao@lyft.com>
|
||||
kgalli <mail@kgalli.de>
|
||||
Khanh Ngo <k@ndk.name>
|
||||
Kirill <g4s8.public@gmail.com>
|
||||
Konrad Malawski <konrad.malawski@project13.pl>
|
||||
Kookheon Kwon <kucuny@gmail.com>
|
||||
|
|
@ -266,10 +291,12 @@ Kshitij Saraogi <KshitijSaraogi@gmail.com>
|
|||
Kumar Saurabh <itsksaurabh@gmail.com>
|
||||
Kyle Kurz <kyle@doublekaudio.com>
|
||||
kyokomi <kyoko1220adword@gmail.com>
|
||||
Lachlan Cooper <lachlancooper@gmail.com>
|
||||
Lars Lehtonen <lars.lehtonen@gmail.com>
|
||||
Laurent Verdoïa <verdoialaurent@gmail.com>
|
||||
leopoldwang <leopold.wang@gmail.com>
|
||||
Liam Galvin <liam@liam-galvin.co.uk>
|
||||
Liam Stanley <liam@liam.sh>
|
||||
Lluis Campos <lluis.campos@northern.tech>
|
||||
Lovro Mažgon <lovro.mazgon@gmail.com>
|
||||
Loïs Postula <lois@postu.la>
|
||||
|
|
@ -283,6 +310,8 @@ Luke Kysow <lkysow@gmail.com>
|
|||
Luke Roberts <email@luke-roberts.co.uk>
|
||||
Luke Young <luke@hydrantlabs.org>
|
||||
lynn [they] <lynncyrin@gmail.com>
|
||||
Léo Salé <leo.sale@datadoghq.com>
|
||||
M. Ryan Rigdon <mr.rigdon@gmail.com>
|
||||
Magnus Kulke <mkulke@gmail.com>
|
||||
Maksim Zhylinski <uzzable@gmail.com>
|
||||
Marc Binder <marcandrebinder@gmail.com>
|
||||
|
|
@ -294,6 +323,7 @@ Martins Sipenko <martins.sipenko@gmail.com>
|
|||
Marwan Sulaiman <marwan.sameer@gmail.com>
|
||||
Masayuki Izumi <m@izum.in>
|
||||
Mat Geist <matgeist@gmail.com>
|
||||
Matheus Santos Araújo <wenked.matheus@yahoo.com.br>
|
||||
Matija Horvat <horvat2112@gmail.com>
|
||||
Matin Rahmanian <itsmatinx@gmail.com>
|
||||
Matt <alpmatthew@gmail.com>
|
||||
|
|
@ -301,8 +331,10 @@ Matt Brender <mjbrender@gmail.com>
|
|||
Matt Dainty <matt@bodgit-n-scarper.com>
|
||||
Matt Gaunt <matt@gauntface.co.uk>
|
||||
Matt Landis <landis.matt@gmail.com>
|
||||
Matt Mencel <matt@techminer.net>
|
||||
Matt Moore <mattmoor@vmware.com>
|
||||
Matt Simons <mattsimons@ntlworld.com>
|
||||
Matthew Reidy <matthewreidy5@gmail.com>
|
||||
Maxime Bury <maxime.bury@gmail.com>
|
||||
Michael Meng <mmeng@lyft.com>
|
||||
Michael Spiegel <michael.m.spiegel@gmail.com>
|
||||
|
|
@ -311,8 +343,11 @@ Michał Glapa <michal.glapa@gmail.com>
|
|||
Michelangelo Morrillo <michelangelo@morrillo.it>
|
||||
Miguel Elias dos Santos <migueleliasweb@gmail.com>
|
||||
Mike Chen <mchen300@gmail.com>
|
||||
Mishin Nikolai <sanduku.default@gmail.com>
|
||||
mohammad ali <2018cs92@student.uet.edu.pk>
|
||||
Mohammed AlDujaili <avainer11@gmail.com>
|
||||
Mohammed Nafees <hello@mnafees.me>
|
||||
Mudit <zeusdeux@gmail.com>
|
||||
Mukundan Senthil <mukundan314@gmail.com>
|
||||
Munia Balayil <munia.247@gmail.com>
|
||||
Mustafa Abban <mustafaabban@utexas.edu>
|
||||
|
|
@ -320,16 +355,20 @@ Nadav Kaner <nadavkaner1@gmail.com>
|
|||
Naoki Kanatani <k12naoki@gmail.com>
|
||||
Nathan VanBenschoten <nvanbenschoten@gmail.com>
|
||||
Navaneeth Suresh <navaneeths1998@gmail.com>
|
||||
Nayeem Hasan <nayeemhasan.nh01@gmail.com>
|
||||
Neal Caffery <neal1991@sina.com>
|
||||
Neil O'Toole <neilotoole@apache.org>
|
||||
Nicholas Herring <oss@hakshak.com>
|
||||
Nick Miyake <nmiyake@palantir.com>
|
||||
Nick Platt <hello@nickplatt.co.uk>
|
||||
Nick Spragg <nick.spragg@bbc.co.uk>
|
||||
Nicolas Chapurlat <nc@coorganix.com>
|
||||
Nikhita Raghunath <nikitaraghunath@gmail.com>
|
||||
Nikita Pivkin <nikita.pivkin@smartforce.io>
|
||||
Nilesh Singh <nilesh.singh24@outlook.com>
|
||||
Noah Hanjun Lee <noah.lee@buzzvil.com>
|
||||
Noah Zoschke <noah+sso2@convox.com>
|
||||
Noble Varghese <noblekvarghese96@gmail.com>
|
||||
ns-cweber <cweber@narrativescience.com>
|
||||
nxya <nathacutlan@gmail.com>
|
||||
Ole Orhagen <ole.orhagen@northern.tech>
|
||||
|
|
@ -357,6 +396,7 @@ Pierce McEntagart <pierce@nightfall.ai>
|
|||
Pierre Carrier <pierre@meteor.com>
|
||||
Piotr Zurek <p.zurek@gmail.com>
|
||||
Piyush Chugh <piyushchugh1993@gmail.com>
|
||||
Pj Meyer <peej.meyer@gmail.com>
|
||||
Pratik Mallya <pratik.mallya@gmail.com>
|
||||
Qais Patankar <qaisjp@gmail.com>
|
||||
Quang Le Hong <iamquang95@gmail.com>
|
||||
|
|
@ -369,6 +409,7 @@ Rafael Aramizu Gomes <rafael.aramizu@mercadolivre.com>
|
|||
Rajat Jindal <rajatjindal83@gmail.com>
|
||||
Rajendra arora <rajendraarora16@yahoo.com>
|
||||
Rajkumar <princegosavi12@gmail.com>
|
||||
Ramesh Gaikwad <rameshgkwd05@gmail.com>
|
||||
Ranbir Singh <binkkatal.r@gmail.com>
|
||||
Ravi Shekhar Jethani <rsjethani@gmail.com>
|
||||
RaviTeja Pothana <ravi-teja@live.com>
|
||||
|
|
@ -378,18 +419,23 @@ Reetuparna Mukherjee <reetuparna.1988@gmail.com>
|
|||
reeves122 <reeves122@gmail.com>
|
||||
Reinier Timmer <reinier.timmer@ah.nl>
|
||||
Renjith R <renjithr201097@gmail.com>
|
||||
Rez Moss <hi@rezmoss.com>
|
||||
Riaje <francois@mbfr.fr>
|
||||
Ricco Førgaard <ricco@fiskeben.dk>
|
||||
Richard de Vries <richard.de.vries@topicus.nl>
|
||||
Rob Figueiredo <robfig@yext.com>
|
||||
Rohit Upadhyay <urohit011@gmail.com>
|
||||
Rojan Dinc <rojand94@gmail.com>
|
||||
Roming22 <roming22@gmail.com>
|
||||
Ronak Jain <ronakjain@outlook.in>
|
||||
Ronan Pelliard <ronan.pelliard@datadoghq.com>
|
||||
Ross Gustafson <srgustafson8@icloud.com>
|
||||
Ruben Vereecken <rubenvereecken@gmail.com>
|
||||
Rufina Talalaeva <rufusnorbert14@gmail.com>
|
||||
Russell Boley <raboley@gmail.com>
|
||||
Ryan Leung <rleungx@gmail.com>
|
||||
Ryan Lower <rpjlower@gmail.com>
|
||||
Ryan Skidmore <github@ryanskidmore.co.uk>
|
||||
Ryo Nakao <nakabonne@gmail.com>
|
||||
Saaarah <sarah.liusy@gmail.com>
|
||||
Safwan Olaimat <safwan.olaimat@gmail.com>
|
||||
|
|
@ -430,6 +476,7 @@ Steve Teuber <github@steveteuber.com>
|
|||
Stian Eikeland <stian@eikeland.se>
|
||||
Suhaib Mujahid <suhaibmujahid@gmail.com>
|
||||
sushmita wable <sw09007@gmail.com>
|
||||
Sven Palberg <oss@palberg.de>
|
||||
Szymon Kodrebski <simonkey007@gmail.com>
|
||||
Søren Hansen <soren@dinero.dk>
|
||||
T.J. Corrigan <tjcorr@github.com>
|
||||
|
|
@ -450,6 +497,9 @@ Tingluo Huang <tingluohuang@github.com>
|
|||
tkhandel <tarunkhandelwal.iitr@gmail.com>
|
||||
Tobias Gesellchen <tobias@gesellix.de>
|
||||
Tom Payne <twpayne@gmail.com>
|
||||
Tomasz Adam Skrzypczak <tomasz.adam.skrzypczak@protonmail.com>
|
||||
tomfeigin <tom.feigin@gmail.com>
|
||||
Travis Tomsu <travis.tomsu@gmail.com>
|
||||
Trey Tacon <ttacon@gmail.com>
|
||||
tsbkw <tsbkw0@gmail.com>
|
||||
ttacon <ttacon@gmail.com>
|
||||
|
|
@ -481,6 +531,7 @@ Yurii Soldak <ysoldak@gmail.com>
|
|||
Yusef Mohamadi <yuseferi@gmail.com>
|
||||
Yusuke Kuoka <ykuoka@gmail.com>
|
||||
Zach Latta <zach@zachlatta.com>
|
||||
Ze Peng <zehui.peng@circle.com>
|
||||
zhouhaibing089 <zhouhaibing089@gmail.com>
|
||||
六开箱 <lkxed@outlook.com>
|
||||
缘生 <i@ysicing.me>
|
||||
|
|
@ -173,7 +173,7 @@ func (s *ActionsService) GetCacheUsageForRepo(ctx context.Context, owner, repo s
|
|||
// refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.
|
||||
//
|
||||
// Permissions: You must authenticate using an access token with the read:org scope to use this endpoint.
|
||||
// GitHub Apps must have the organization_admistration:read permission to use this endpoint.
|
||||
// GitHub Apps must have the organization_administration:read permission to use this endpoint.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization
|
||||
//
|
||||
|
|
@ -203,7 +203,7 @@ func (s *ActionsService) ListCacheUsageByRepoForOrg(ctx context.Context, org str
|
|||
// 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.
|
||||
//
|
||||
// Permissions: You must authenticate using an access token with the read:org scope to use this endpoint.
|
||||
// GitHub Apps must have the organization_admistration:read permission to use this endpoint.
|
||||
// GitHub Apps must have the organization_administration:read permission to use this endpoint.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization
|
||||
//
|
||||
|
|
@ -151,12 +151,18 @@ type Runners struct {
|
|||
Runners []*Runner `json:"runners"`
|
||||
}
|
||||
|
||||
// ListRunnersOptions specifies the optional parameters to the ListRunners and ListOrganizationRunners methods.
|
||||
type ListRunnersOptions struct {
|
||||
Name *string `url:"name,omitempty"`
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// ListRunners lists all the self-hosted runners for a repository.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository
|
||||
//
|
||||
//meta:operation GET /repos/{owner}/{repo}/actions/runners
|
||||
func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, opts *ListOptions) (*Runners, *Response, error) {
|
||||
func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, opts *ListRunnersOptions) (*Runners, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/actions/runners", owner, repo)
|
||||
u, err := addOptions(u, opts)
|
||||
if err != nil {
|
||||
|
|
@ -290,7 +296,7 @@ func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context
|
|||
// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/actions/runners
|
||||
func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string, opts *ListOptions) (*Runners, *Response, error) {
|
||||
func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string, opts *ListRunnersOptions) (*Runners, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners", org)
|
||||
u, err := addOptions(u, opts)
|
||||
if err != nil {
|
||||
|
|
@ -84,7 +84,7 @@ func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*Publ
|
|||
|
||||
// GetEnvPublicKey gets a public key that should be used for secret encryption.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-environment-public-key
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#get-an-environment-public-key
|
||||
//
|
||||
//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key
|
||||
func (s *ActionsService) GetEnvPublicKey(ctx context.Context, repoID int, env string) (*PublicKey, *Response, error) {
|
||||
|
|
@ -162,7 +162,7 @@ func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *L
|
|||
|
||||
// ListEnvSecrets lists all secrets available in an environment.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-environment-secrets
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#list-environment-secrets
|
||||
//
|
||||
//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets
|
||||
func (s *ActionsService) ListEnvSecrets(ctx context.Context, repoID int, env string, opts *ListOptions) (*Secrets, *Response, error) {
|
||||
|
|
@ -207,7 +207,7 @@ func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*S
|
|||
|
||||
// GetEnvSecret gets a single environment secret without revealing its encrypted value.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-environment-secret
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#get-an-environment-secret
|
||||
//
|
||||
//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}
|
||||
func (s *ActionsService) GetEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Secret, *Response, error) {
|
||||
|
|
@ -262,7 +262,7 @@ func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string
|
|||
|
||||
// CreateOrUpdateEnvSecret creates or updates a single environment secret with an encrypted value.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#create-or-update-an-environment-secret
|
||||
//
|
||||
//meta:operation PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}
|
||||
func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, repoID int, env string, eSecret *EncryptedSecret) (*Response, error) {
|
||||
|
|
@ -301,7 +301,7 @@ func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string)
|
|||
|
||||
// DeleteEnvSecret deletes a secret in an environment using the secret name.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/secrets#delete-an-environment-secret
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#delete-an-environment-secret
|
||||
//
|
||||
//meta:operation DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}
|
||||
func (s *ActionsService) DeleteEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Response, error) {
|
||||
|
|
@ -83,9 +83,9 @@ func (s *ActionsService) ListOrgVariables(ctx context.Context, org string, opts
|
|||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/variables#list-environment-variables
|
||||
//
|
||||
//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/variables
|
||||
func (s *ActionsService) ListEnvVariables(ctx context.Context, repoID int, env string, opts *ListOptions) (*ActionsVariables, *Response, error) {
|
||||
url := fmt.Sprintf("repositories/%v/environments/%v/variables", repoID, env)
|
||||
//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables
|
||||
func (s *ActionsService) ListEnvVariables(ctx context.Context, owner, repo, env string, opts *ListOptions) (*ActionsVariables, *Response, error) {
|
||||
url := fmt.Sprintf("repos/%v/%v/environments/%v/variables", owner, repo, env)
|
||||
return s.listVariables(ctx, url, opts)
|
||||
}
|
||||
|
||||
|
|
@ -128,9 +128,9 @@ func (s *ActionsService) GetOrgVariable(ctx context.Context, org, name string) (
|
|||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/variables#get-an-environment-variable
|
||||
//
|
||||
//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/variables/{name}
|
||||
func (s *ActionsService) GetEnvVariable(ctx context.Context, repoID int, env, variableName string) (*ActionsVariable, *Response, error) {
|
||||
url := fmt.Sprintf("repositories/%v/environments/%v/variables/%v", repoID, env, variableName)
|
||||
//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}
|
||||
func (s *ActionsService) GetEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*ActionsVariable, *Response, error) {
|
||||
url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variableName)
|
||||
return s.getVariable(ctx, url)
|
||||
}
|
||||
|
||||
|
|
@ -166,9 +166,9 @@ func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, vari
|
|||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/variables#create-an-environment-variable
|
||||
//
|
||||
//meta:operation POST /repositories/{repository_id}/environments/{environment_name}/variables
|
||||
func (s *ActionsService) CreateEnvVariable(ctx context.Context, repoID int, env string, variable *ActionsVariable) (*Response, error) {
|
||||
url := fmt.Sprintf("repositories/%v/environments/%v/variables", repoID, env)
|
||||
//meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/variables
|
||||
func (s *ActionsService) CreateEnvVariable(ctx context.Context, owner, repo, env string, variable *ActionsVariable) (*Response, error) {
|
||||
url := fmt.Sprintf("repos/%v/%v/environments/%v/variables", owner, repo, env)
|
||||
return s.postVariable(ctx, url, variable)
|
||||
}
|
||||
|
||||
|
|
@ -204,9 +204,9 @@ func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org string, vari
|
|||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/variables#update-an-environment-variable
|
||||
//
|
||||
//meta:operation PATCH /repositories/{repository_id}/environments/{environment_name}/variables/{name}
|
||||
func (s *ActionsService) UpdateEnvVariable(ctx context.Context, repoID int, env string, variable *ActionsVariable) (*Response, error) {
|
||||
url := fmt.Sprintf("repositories/%v/environments/%v/variables/%v", repoID, env, variable.Name)
|
||||
//meta:operation PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}
|
||||
func (s *ActionsService) UpdateEnvVariable(ctx context.Context, owner, repo, env string, variable *ActionsVariable) (*Response, error) {
|
||||
url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variable.Name)
|
||||
return s.patchVariable(ctx, url, variable)
|
||||
}
|
||||
|
||||
|
|
@ -243,9 +243,9 @@ func (s *ActionsService) DeleteOrgVariable(ctx context.Context, org, name string
|
|||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-an-environment-variable
|
||||
//
|
||||
//meta:operation DELETE /repositories/{repository_id}/environments/{environment_name}/variables/{name}
|
||||
func (s *ActionsService) DeleteEnvVariable(ctx context.Context, repoID int, env, variableName string) (*Response, error) {
|
||||
url := fmt.Sprintf("repositories/%v/environments/%v/variables/%v", repoID, env, variableName)
|
||||
//meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}
|
||||
func (s *ActionsService) DeleteEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*Response, error) {
|
||||
url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variableName)
|
||||
return s.deleteVariable(ctx, url)
|
||||
}
|
||||
|
||||
|
|
@ -19,6 +19,7 @@ type WorkflowRun struct {
|
|||
NodeID *string `json:"node_id,omitempty"`
|
||||
HeadBranch *string `json:"head_branch,omitempty"`
|
||||
HeadSHA *string `json:"head_sha,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
RunNumber *int `json:"run_number,omitempty"`
|
||||
RunAttempt *int `json:"run_attempt,omitempty"`
|
||||
Event *string `json:"event,omitempty"`
|
||||
|
|
@ -111,6 +112,31 @@ type ReferencedWorkflow struct {
|
|||
Ref *string `json:"ref,omitempty"`
|
||||
}
|
||||
|
||||
// PendingDeployment represents the pending_deployments response.
|
||||
type PendingDeployment struct {
|
||||
Environment *PendingDeploymentEnvironment `json:"environment,omitempty"`
|
||||
WaitTimer *int64 `json:"wait_timer,omitempty"`
|
||||
WaitTimerStartedAt *Timestamp `json:"wait_timer_started_at,omitempty"`
|
||||
CurrentUserCanApprove *bool `json:"current_user_can_approve,omitempty"`
|
||||
Reviewers []*RequiredReviewer `json:"reviewers,omitempty"`
|
||||
}
|
||||
|
||||
// PendingDeploymentEnvironment represents pending deployment environment properties.
|
||||
type PendingDeploymentEnvironment struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
}
|
||||
|
||||
// ReviewCustomDeploymentProtectionRuleRequest specifies the parameters to ReviewCustomDeploymentProtectionRule.
|
||||
type ReviewCustomDeploymentProtectionRuleRequest struct {
|
||||
EnvironmentName string `json:"environment_name"`
|
||||
State string `json:"state"`
|
||||
Comment string `json:"comment"`
|
||||
}
|
||||
|
||||
func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) {
|
||||
u, err := addOptions(endpoint, opts)
|
||||
if err != nil {
|
||||
|
|
@ -387,6 +413,28 @@ func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, rep
|
|||
return workflowRunUsage, resp, nil
|
||||
}
|
||||
|
||||
// GetPendingDeployments get all deployment environments for a workflow run that are waiting for protection rules to pass.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-pending-deployments-for-a-workflow-run
|
||||
//
|
||||
//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments
|
||||
func (s *ActionsService) GetPendingDeployments(ctx context.Context, owner, repo string, runID int64) ([]*PendingDeployment, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/pending_deployments", owner, repo, runID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var deployments []*PendingDeployment
|
||||
resp, err := s.client.Do(ctx, req, &deployments)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return deployments, resp, nil
|
||||
}
|
||||
|
||||
// PendingDeployments approve or reject pending deployments that are waiting on approval by a required reviewer.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run
|
||||
|
|
@ -408,3 +456,20 @@ func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo str
|
|||
|
||||
return deployments, resp, nil
|
||||
}
|
||||
|
||||
// ReviewCustomDeploymentProtectionRule approves or rejects custom deployment protection rules provided by a GitHub App for a workflow run.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#review-custom-deployment-protection-rules-for-a-workflow-run
|
||||
//
|
||||
//meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule
|
||||
func (s *ActionsService) ReviewCustomDeploymentProtectionRule(ctx context.Context, owner, repo string, runID int64, request *ReviewCustomDeploymentProtectionRuleRequest) (*Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/deployment_protection_rule", owner, repo, runID)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := s.client.Do(ctx, req, nil)
|
||||
return resp, err
|
||||
}
|
||||
|
|
@ -178,6 +178,23 @@ func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Respo
|
|||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// MarkThreadDone marks the specified thread as done.
|
||||
// Marking a thread as "done" is equivalent to marking a notification in your notification inbox on GitHub as done.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-done
|
||||
//
|
||||
//meta:operation DELETE /notifications/threads/{thread_id}
|
||||
func (s *ActivityService) MarkThreadDone(ctx context.Context, id int64) (*Response, error) {
|
||||
u := fmt.Sprintf("notifications/threads/%v", id)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// GetThreadSubscription checks to see if the authenticated user is subscribed
|
||||
// to a thread.
|
||||
//
|
||||
|
|
@ -82,7 +82,7 @@ func (m Enterprise) String() string {
|
|||
|
||||
// UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user
|
||||
//
|
||||
//meta:operation PATCH /admin/ldap/users/{username}/mapping
|
||||
func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) {
|
||||
|
|
@ -103,7 +103,7 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m
|
|||
|
||||
// UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team
|
||||
//
|
||||
//meta:operation PATCH /admin/ldap/teams/{team_id}/mapping
|
||||
func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) {
|
||||
|
|
@ -22,7 +22,7 @@ type createOrgRequest struct {
|
|||
// Note that only a subset of the org fields are used and org must
|
||||
// not be nil.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#create-an-organization
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/orgs#create-an-organization
|
||||
//
|
||||
//meta:operation POST /admin/organizations
|
||||
func (s *AdminService) CreateOrg(ctx context.Context, org *Organization, admin string) (*Organization, *Response, error) {
|
||||
|
|
@ -61,7 +61,7 @@ type RenameOrgResponse struct {
|
|||
|
||||
// RenameOrg renames an organization in GitHub Enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#update-an-organization-name
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/orgs#update-an-organization-name
|
||||
//
|
||||
//meta:operation PATCH /admin/organizations/{org}
|
||||
func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName string) (*RenameOrgResponse, *Response, error) {
|
||||
|
|
@ -70,7 +70,7 @@ func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName
|
|||
|
||||
// RenameOrgByName renames an organization in GitHub Enterprise using its current name.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#update-an-organization-name
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/orgs#update-an-organization-name
|
||||
//
|
||||
//meta:operation PATCH /admin/organizations/{org}
|
||||
func (s *AdminService) RenameOrgByName(ctx context.Context, org, newName string) (*RenameOrgResponse, *Response, error) {
|
||||
|
|
@ -152,7 +152,7 @@ func (s RepoStats) String() string {
|
|||
// Please note that this is only available to site administrators,
|
||||
// otherwise it will error with a 404 not found (instead of 401 or 403).
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-all-statistics
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-all-statistics
|
||||
//
|
||||
//meta:operation GET /enterprise/stats/all
|
||||
func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) {
|
||||
|
|
@ -20,7 +20,7 @@ type CreateUserRequest struct {
|
|||
|
||||
// CreateUser creates a new user in GitHub Enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-a-user
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#create-a-user
|
||||
//
|
||||
//meta:operation POST /admin/users
|
||||
func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest) (*User, *Response, error) {
|
||||
|
|
@ -42,7 +42,7 @@ func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest
|
|||
|
||||
// DeleteUser deletes a user in GitHub Enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-user
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-a-user
|
||||
//
|
||||
//meta:operation DELETE /admin/users/{username}
|
||||
func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) {
|
||||
|
|
@ -95,7 +95,7 @@ type UserAuthorization struct {
|
|||
|
||||
// CreateUserImpersonation creates an impersonation OAuth token.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-an-impersonation-oauth-token
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#create-an-impersonation-oauth-token
|
||||
//
|
||||
//meta:operation POST /admin/users/{username}/authorizations
|
||||
func (s *AdminService) CreateUserImpersonation(ctx context.Context, username string, opts *ImpersonateUserOptions) (*UserAuthorization, *Response, error) {
|
||||
|
|
@ -117,7 +117,7 @@ func (s *AdminService) CreateUserImpersonation(ctx context.Context, username str
|
|||
|
||||
// DeleteUserImpersonation deletes an impersonation OAuth token.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-an-impersonation-oauth-token
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-an-impersonation-oauth-token
|
||||
//
|
||||
//meta:operation DELETE /admin/users/{username}/authorizations
|
||||
func (s *AdminService) DeleteUserImpersonation(ctx context.Context, username string) (*Response, error) {
|
||||
|
|
@ -56,6 +56,20 @@ type InstallationTokenOptions struct {
|
|||
Permissions *InstallationPermissions `json:"permissions,omitempty"`
|
||||
}
|
||||
|
||||
type InstallationTokenListRepoOptions struct {
|
||||
// The IDs of the repositories that the installation token can access.
|
||||
// Providing repository IDs restricts the access of an installation token to specific repositories.
|
||||
RepositoryIDs []int64 `json:"repository_ids"`
|
||||
|
||||
// The names of the repositories that the installation token can access.
|
||||
// Providing repository names restricts the access of an installation token to specific repositories.
|
||||
Repositories []string `json:"repositories,omitempty"`
|
||||
|
||||
// The permissions granted to the access token.
|
||||
// The permissions object includes the permission names and their access type.
|
||||
Permissions *InstallationPermissions `json:"permissions,omitempty"`
|
||||
}
|
||||
|
||||
// InstallationPermissions lists the repository and organization permissions for an installation.
|
||||
//
|
||||
// Permission names taken from:
|
||||
|
|
@ -63,43 +77,48 @@ type InstallationTokenOptions struct {
|
|||
// https://docs.github.com/enterprise-server@3.0/rest/apps#create-an-installation-access-token-for-an-app
|
||||
// https://docs.github.com/rest/apps#create-an-installation-access-token-for-an-app
|
||||
type InstallationPermissions struct {
|
||||
Actions *string `json:"actions,omitempty"`
|
||||
Administration *string `json:"administration,omitempty"`
|
||||
Blocking *string `json:"blocking,omitempty"`
|
||||
Checks *string `json:"checks,omitempty"`
|
||||
Contents *string `json:"contents,omitempty"`
|
||||
ContentReferences *string `json:"content_references,omitempty"`
|
||||
Deployments *string `json:"deployments,omitempty"`
|
||||
Emails *string `json:"emails,omitempty"`
|
||||
Environments *string `json:"environments,omitempty"`
|
||||
Followers *string `json:"followers,omitempty"`
|
||||
Issues *string `json:"issues,omitempty"`
|
||||
Metadata *string `json:"metadata,omitempty"`
|
||||
Members *string `json:"members,omitempty"`
|
||||
OrganizationAdministration *string `json:"organization_administration,omitempty"`
|
||||
OrganizationCustomRoles *string `json:"organization_custom_roles,omitempty"`
|
||||
OrganizationHooks *string `json:"organization_hooks,omitempty"`
|
||||
OrganizationPackages *string `json:"organization_packages,omitempty"`
|
||||
OrganizationPlan *string `json:"organization_plan,omitempty"`
|
||||
OrganizationPreReceiveHooks *string `json:"organization_pre_receive_hooks,omitempty"`
|
||||
OrganizationProjects *string `json:"organization_projects,omitempty"`
|
||||
OrganizationSecrets *string `json:"organization_secrets,omitempty"`
|
||||
OrganizationSelfHostedRunners *string `json:"organization_self_hosted_runners,omitempty"`
|
||||
OrganizationUserBlocking *string `json:"organization_user_blocking,omitempty"`
|
||||
Packages *string `json:"packages,omitempty"`
|
||||
Pages *string `json:"pages,omitempty"`
|
||||
PullRequests *string `json:"pull_requests,omitempty"`
|
||||
RepositoryHooks *string `json:"repository_hooks,omitempty"`
|
||||
RepositoryProjects *string `json:"repository_projects,omitempty"`
|
||||
RepositoryPreReceiveHooks *string `json:"repository_pre_receive_hooks,omitempty"`
|
||||
Secrets *string `json:"secrets,omitempty"`
|
||||
SecretScanningAlerts *string `json:"secret_scanning_alerts,omitempty"`
|
||||
SecurityEvents *string `json:"security_events,omitempty"`
|
||||
SingleFile *string `json:"single_file,omitempty"`
|
||||
Statuses *string `json:"statuses,omitempty"`
|
||||
TeamDiscussions *string `json:"team_discussions,omitempty"`
|
||||
VulnerabilityAlerts *string `json:"vulnerability_alerts,omitempty"`
|
||||
Workflows *string `json:"workflows,omitempty"`
|
||||
Actions *string `json:"actions,omitempty"`
|
||||
ActionsVariables *string `json:"actions_variables,omitempty"`
|
||||
Administration *string `json:"administration,omitempty"`
|
||||
Blocking *string `json:"blocking,omitempty"`
|
||||
Checks *string `json:"checks,omitempty"`
|
||||
Contents *string `json:"contents,omitempty"`
|
||||
ContentReferences *string `json:"content_references,omitempty"`
|
||||
Deployments *string `json:"deployments,omitempty"`
|
||||
Emails *string `json:"emails,omitempty"`
|
||||
Environments *string `json:"environments,omitempty"`
|
||||
Followers *string `json:"followers,omitempty"`
|
||||
Issues *string `json:"issues,omitempty"`
|
||||
Metadata *string `json:"metadata,omitempty"`
|
||||
Members *string `json:"members,omitempty"`
|
||||
OrganizationAdministration *string `json:"organization_administration,omitempty"`
|
||||
OrganizationCustomProperties *string `json:"organization_custom_properties,omitempty"`
|
||||
OrganizationCustomRoles *string `json:"organization_custom_roles,omitempty"`
|
||||
OrganizationCustomOrgRoles *string `json:"organization_custom_org_roles,omitempty"`
|
||||
OrganizationHooks *string `json:"organization_hooks,omitempty"`
|
||||
OrganizationPackages *string `json:"organization_packages,omitempty"`
|
||||
OrganizationPersonalAccessTokens *string `json:"organization_personal_access_tokens,omitempty"`
|
||||
OrganizationPersonalAccessTokenRequests *string `json:"organization_personal_access_token_requests,omitempty"`
|
||||
OrganizationPlan *string `json:"organization_plan,omitempty"`
|
||||
OrganizationPreReceiveHooks *string `json:"organization_pre_receive_hooks,omitempty"`
|
||||
OrganizationProjects *string `json:"organization_projects,omitempty"`
|
||||
OrganizationSecrets *string `json:"organization_secrets,omitempty"`
|
||||
OrganizationSelfHostedRunners *string `json:"organization_self_hosted_runners,omitempty"`
|
||||
OrganizationUserBlocking *string `json:"organization_user_blocking,omitempty"`
|
||||
Packages *string `json:"packages,omitempty"`
|
||||
Pages *string `json:"pages,omitempty"`
|
||||
PullRequests *string `json:"pull_requests,omitempty"`
|
||||
RepositoryHooks *string `json:"repository_hooks,omitempty"`
|
||||
RepositoryProjects *string `json:"repository_projects,omitempty"`
|
||||
RepositoryPreReceiveHooks *string `json:"repository_pre_receive_hooks,omitempty"`
|
||||
Secrets *string `json:"secrets,omitempty"`
|
||||
SecretScanningAlerts *string `json:"secret_scanning_alerts,omitempty"`
|
||||
SecurityEvents *string `json:"security_events,omitempty"`
|
||||
SingleFile *string `json:"single_file,omitempty"`
|
||||
Statuses *string `json:"statuses,omitempty"`
|
||||
TeamDiscussions *string `json:"team_discussions,omitempty"`
|
||||
VulnerabilityAlerts *string `json:"vulnerability_alerts,omitempty"`
|
||||
Workflows *string `json:"workflows,omitempty"`
|
||||
}
|
||||
|
||||
// InstallationRequest represents a pending GitHub App installation request.
|
||||
|
|
@ -343,6 +362,30 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opt
|
|||
return t, resp, nil
|
||||
}
|
||||
|
||||
// CreateInstallationTokenListRepos creates a new installation token with a list of all repositories in an installation which is not possible with CreateInstallationToken.
|
||||
//
|
||||
// It differs from CreateInstallationToken by taking InstallationTokenListRepoOptions as a parameter which does not omit RepositoryIDs if that field is nil or an empty array.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app
|
||||
//
|
||||
//meta:operation POST /app/installations/{installation_id}/access_tokens
|
||||
func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id int64, opts *InstallationTokenListRepoOptions) (*InstallationToken, *Response, error) {
|
||||
u := fmt.Sprintf("app/installations/%v/access_tokens", id)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
t := new(InstallationToken)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return t, resp, nil
|
||||
}
|
||||
|
||||
// CreateAttachment creates a new attachment on user comment containing a url.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#create-a-content-attachment
|
||||
|
|
@ -257,7 +257,7 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces
|
|||
// you can e.g. create or delete a user's public SSH key. NOTE: creating a
|
||||
// new token automatically revokes an existing one.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-an-impersonation-oauth-token
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#create-an-impersonation-oauth-token
|
||||
//
|
||||
//meta:operation POST /admin/users/{username}/authorizations
|
||||
func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) {
|
||||
|
|
@ -279,7 +279,7 @@ func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, usernam
|
|||
//
|
||||
// NOTE: there can be only one at a time.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-an-impersonation-oauth-token
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-an-impersonation-oauth-token
|
||||
//
|
||||
//meta:operation DELETE /admin/users/{username}/authorizations
|
||||
func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) {
|
||||
|
|
@ -43,8 +43,11 @@ type StorageBilling struct {
|
|||
|
||||
// ActiveCommitters represents the total active committers across all repositories in an Organization.
|
||||
type ActiveCommitters struct {
|
||||
TotalAdvancedSecurityCommitters int `json:"total_advanced_security_committers"`
|
||||
Repositories []*RepositoryActiveCommitters `json:"repositories,omitempty"`
|
||||
TotalAdvancedSecurityCommitters int `json:"total_advanced_security_committers"`
|
||||
TotalCount int `json:"total_count"`
|
||||
MaximumAdvancedSecurityCommitters int `json:"maximum_advanced_security_committers"`
|
||||
PurchasedAdvancedSecurityCommitters int `json:"purchased_advanced_security_committers"`
|
||||
Repositories []*RepositoryActiveCommitters `json:"repositories,omitempty"`
|
||||
}
|
||||
|
||||
// RepositoryActiveCommitters represents active committers on each repository.
|
||||
|
|
@ -85,7 +85,10 @@ type CheckSuite struct {
|
|||
PullRequests []*PullRequest `json:"pull_requests,omitempty"`
|
||||
|
||||
// The following fields are only populated by Webhook events.
|
||||
HeadCommit *Commit `json:"head_commit,omitempty"`
|
||||
HeadCommit *Commit `json:"head_commit,omitempty"`
|
||||
LatestCheckRunsCount *int64 `json:"latest_check_runs_count,omitempty"`
|
||||
Rerequstable *bool `json:"rerequestable,omitempty"`
|
||||
RunsRerequstable *bool `json:"runs_rerequestable,omitempty"`
|
||||
}
|
||||
|
||||
func (c CheckRun) String() string {
|
||||
|
|
@ -132,7 +132,7 @@ func (cp *CopilotSeatDetails) GetOrganization() (*Organization, bool) {
|
|||
|
||||
// GetCopilotBilling gets Copilot for Business billing information and settings for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-information-and-settings-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-information-and-settings-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/copilot/billing
|
||||
func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*CopilotOrganizationDetails, *Response, error) {
|
||||
|
|
@ -156,13 +156,17 @@ func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*Co
|
|||
//
|
||||
// To paginate through all seats, populate 'Page' with the number of the last page.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#list-all-copilot-business-seat-assignments-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#list-all-copilot-seat-assignments-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/copilot/billing/seats
|
||||
func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/copilot/billing/seats", org)
|
||||
u, err := addOptions(u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opts)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
@ -178,7 +182,7 @@ func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts
|
|||
|
||||
// AddCopilotTeams adds teams to the Copilot for Business subscription for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#add-teams-to-the-copilot-business-subscription-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#add-teams-to-the-copilot-subscription-for-an-organization
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/copilot/billing/selected_teams
|
||||
func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatAssignments, *Response, error) {
|
||||
|
|
@ -206,7 +210,7 @@ func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNa
|
|||
|
||||
// RemoveCopilotTeams removes teams from the Copilot for Business subscription for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#remove-teams-from-the-copilot-business-subscription-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#remove-teams-from-the-copilot-subscription-for-an-organization
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/copilot/billing/selected_teams
|
||||
func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatCancellations, *Response, error) {
|
||||
|
|
@ -234,7 +238,7 @@ func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, tea
|
|||
|
||||
// AddCopilotUsers adds users to the Copilot for Business subscription for an organization
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#add-users-to-the-copilot-business-subscription-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#add-users-to-the-copilot-subscription-for-an-organization
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/copilot/billing/selected_users
|
||||
func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users []string) (*SeatAssignments, *Response, error) {
|
||||
|
|
@ -262,7 +266,7 @@ func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users
|
|||
|
||||
// RemoveCopilotUsers removes users from the Copilot for Business subscription for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#remove-users-from-the-copilot-business-subscription-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#remove-users-from-the-copilot-subscription-for-an-organization
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/copilot/billing/selected_users
|
||||
func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, users []string) (*SeatCancellations, *Response, error) {
|
||||
|
|
@ -290,7 +294,7 @@ func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, use
|
|||
|
||||
// GetSeatDetails gets Copilot for Business seat assignment details for a user.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-assignment-details-for-a-user
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-assignment-details-for-a-user
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/members/{username}/copilot
|
||||
func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) (*CopilotSeatDetails, *Response, error) {
|
||||
113
vendor/github.com/google/go-github/v66/github/dependency_graph_snapshots.go
generated
vendored
Normal file
113
vendor/github.com/google/go-github/v66/github/dependency_graph_snapshots.go
generated
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
// Copyright 2023 The go-github AUTHORS. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// DependencyGraphSnapshotResolvedDependency represents a resolved dependency in a dependency graph snapshot.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
type DependencyGraphSnapshotResolvedDependency struct {
|
||||
PackageURL *string `json:"package_url,omitempty"`
|
||||
// Represents whether the dependency is requested directly by the manifest or is a dependency of another dependency.
|
||||
// Can have the following values:
|
||||
// - "direct": indicates that the dependency is requested directly by the manifest.
|
||||
// - "indirect": indicates that the dependency is a dependency of another dependency.
|
||||
Relationship *string `json:"relationship,omitempty"`
|
||||
// Represents whether the dependency is required for the primary build artifact or is only used for development.
|
||||
// Can have the following values:
|
||||
// - "runtime": indicates that the dependency is required for the primary build artifact.
|
||||
// - "development": indicates that the dependency is only used for development.
|
||||
Scope *string `json:"scope,omitempty"`
|
||||
Dependencies []string `json:"dependencies,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyGraphSnapshotJob represents the job that created the snapshot.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
type DependencyGraphSnapshotJob struct {
|
||||
Correlator *string `json:"correlator,omitempty"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyGraphSnapshotDetector represents a description of the detector used.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
type DependencyGraphSnapshotDetector struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Version *string `json:"version,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyGraphSnapshotManifestFile represents the file declaring the repository's dependencies.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
type DependencyGraphSnapshotManifestFile struct {
|
||||
SourceLocation *string `json:"source_location,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyGraphSnapshotManifest represents a collection of related dependencies declared in a file or representing a logical group of dependencies.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
type DependencyGraphSnapshotManifest struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
File *DependencyGraphSnapshotManifestFile `json:"file,omitempty"`
|
||||
Resolved map[string]*DependencyGraphSnapshotResolvedDependency `json:"resolved,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyGraphSnapshot represent a snapshot of a repository's dependencies.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
type DependencyGraphSnapshot struct {
|
||||
Version int `json:"version"`
|
||||
Sha *string `json:"sha,omitempty"`
|
||||
Ref *string `json:"ref,omitempty"`
|
||||
Job *DependencyGraphSnapshotJob `json:"job,omitempty"`
|
||||
Detector *DependencyGraphSnapshotDetector `json:"detector,omitempty"`
|
||||
Scanned *Timestamp `json:"scanned,omitempty"`
|
||||
Manifests map[string]*DependencyGraphSnapshotManifest `json:"manifests,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyGraphSnapshotCreationData represents the dependency snapshot's creation result.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
type DependencyGraphSnapshotCreationData struct {
|
||||
ID int64 `json:"id"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
Message *string `json:"message,omitempty"`
|
||||
// Represents the snapshot creation result.
|
||||
// Can have the following values:
|
||||
// - "SUCCESS": indicates that the snapshot was successfully created and the repository's dependencies were updated.
|
||||
// - "ACCEPTED": indicates that the snapshot was successfully created, but the repository's dependencies were not updated.
|
||||
// - "INVALID": indicates that the snapshot was malformed.
|
||||
Result *string `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
// CreateSnapshot creates a new snapshot of a repository's dependencies.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
//
|
||||
//meta:operation POST /repos/{owner}/{repo}/dependency-graph/snapshots
|
||||
func (s *DependencyGraphService) CreateSnapshot(ctx context.Context, owner, repo string, dependencyGraphSnapshot *DependencyGraphSnapshot) (*DependencyGraphSnapshotCreationData, *Response, error) {
|
||||
url := fmt.Sprintf("repos/%v/%v/dependency-graph/snapshots", owner, repo)
|
||||
|
||||
req, err := s.client.NewRequest("POST", url, dependencyGraphSnapshot)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var snapshotCreationData *DependencyGraphSnapshotCreationData
|
||||
resp, err := s.client.Do(ctx, req, &snapshotCreationData)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return snapshotCreationData, resp, nil
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API.
|
|||
|
||||
Usage:
|
||||
|
||||
import "github.com/google/go-github/v60/github" // with go modules enabled (GO111MODULE=on or outside GOPATH)
|
||||
import "github.com/google/go-github/v66/github" // with go modules enabled (GO111MODULE=on or outside GOPATH)
|
||||
import "github.com/google/go-github/github" // with go modules disabled
|
||||
|
||||
Construct a new GitHub client, then use the various services on the client to
|
||||
|
|
@ -31,7 +31,7 @@ The services of a client divide the API into logical chunks and correspond to
|
|||
the structure of the GitHub API documentation at
|
||||
https://docs.github.com/rest .
|
||||
|
||||
NOTE: Using the https://godoc.org/context package, one can easily
|
||||
NOTE: Using the https://pkg.go.dev/context package, one can easily
|
||||
pass cancelation signals and deadlines to various services of the client for
|
||||
handling a request. In case there is no context available, then context.Background()
|
||||
can be used as a starting point.
|
||||
|
|
@ -80,7 +80,7 @@ func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterpr
|
|||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise
|
||||
//
|
||||
//meta:operation GET /enterprises/{enterprise}/actions/runners
|
||||
func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, opts *ListOptions) (*Runners, *Response, error) {
|
||||
func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, opts *ListRunnersOptions) (*Runners, *Response, error) {
|
||||
u := fmt.Sprintf("enterprises/%v/actions/runners", enterprise)
|
||||
u, err := addOptions(u, opts)
|
||||
if err != nil {
|
||||
|
|
@ -101,6 +101,27 @@ func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string,
|
|||
return runners, resp, nil
|
||||
}
|
||||
|
||||
// GetRunner gets a specific self-hosted runner configured in an enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-enterprise
|
||||
//
|
||||
//meta:operation GET /enterprises/{enterprise}/actions/runners/{runner_id}
|
||||
func (s *EnterpriseService) GetRunner(ctx context.Context, enterprise string, runnerID int64) (*Runner, *Response, error) {
|
||||
u := fmt.Sprintf("enterprises/%v/actions/runners/%v", enterprise, runnerID)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
runner := new(Runner)
|
||||
resp, err := s.client.Do(ctx, req, runner)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return runner, resp, nil
|
||||
}
|
||||
|
||||
// RemoveRunner forces the removal of a self-hosted runner from an enterprise using the runner id.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-enterprise
|
||||
|
|
@ -225,6 +225,46 @@ type DeploymentProtectionRuleEvent struct {
|
|||
Installation *Installation `json:"installation,omitempty"`
|
||||
}
|
||||
|
||||
// DeploymentReviewEvent represents a deployment review event.
|
||||
// The Webhook event name is "deployment_review".
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads?#deployment_review
|
||||
type DeploymentReviewEvent struct {
|
||||
// The action performed. Possible values are: "requested", "approved", or "rejected".
|
||||
Action *string `json:"action,omitempty"`
|
||||
|
||||
// The following will be populated only if requested.
|
||||
Requester *User `json:"requester,omitempty"`
|
||||
Environment *string `json:"environment,omitempty"`
|
||||
|
||||
// The following will be populated only if approved or rejected.
|
||||
Approver *User `json:"approver,omitempty"`
|
||||
Comment *string `json:"comment,omitempty"`
|
||||
WorkflowJobRuns []*WorkflowJobRun `json:"workflow_job_runs,omitempty"`
|
||||
|
||||
Enterprise *Enterprise `json:"enterprise,omitempty"`
|
||||
Installation *Installation `json:"installation,omitempty"`
|
||||
Organization *Organization `json:"organization,omitempty"`
|
||||
Repo *Repository `json:"repository,omitempty"`
|
||||
Reviewers []*RequiredReviewer `json:"reviewers,omitempty"`
|
||||
Sender *User `json:"sender,omitempty"`
|
||||
Since *string `json:"since,omitempty"`
|
||||
WorkflowJobRun *WorkflowJobRun `json:"workflow_job_run,omitempty"`
|
||||
WorkflowRun *WorkflowRun `json:"workflow_run,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowJobRun represents a workflow_job_run in a GitHub DeploymentReviewEvent.
|
||||
type WorkflowJobRun struct {
|
||||
Conclusion *string `json:"conclusion,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
Environment *string `json:"environment,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Status *string `json:"status,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
// DeploymentStatusEvent represents a deployment status.
|
||||
// The Webhook event name is "deployment_status".
|
||||
//
|
||||
|
|
@ -232,6 +272,7 @@ type DeploymentProtectionRuleEvent struct {
|
|||
//
|
||||
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#deployment_status
|
||||
type DeploymentStatusEvent struct {
|
||||
Action *string `json:"action,omitempty"`
|
||||
Deployment *Deployment `json:"deployment,omitempty"`
|
||||
DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"`
|
||||
Repo *Repository `json:"repository,omitempty"`
|
||||
|
|
@ -689,14 +730,34 @@ type MarketplacePurchaseEvent struct {
|
|||
Org *Organization `json:"organization,omitempty"`
|
||||
}
|
||||
|
||||
// MemberEvent is triggered when a user is added as a collaborator to a repository.
|
||||
// MemberChangesPermission represents changes to a repository collaborator's permissions.
|
||||
type MemberChangesPermission struct {
|
||||
From *string `json:"from,omitempty"`
|
||||
To *string `json:"to,omitempty"`
|
||||
}
|
||||
|
||||
// MemberChangesRoleName represents changes to a repository collaborator's role.
|
||||
type MemberChangesRoleName struct {
|
||||
From *string `json:"from,omitempty"`
|
||||
To *string `json:"to,omitempty"`
|
||||
}
|
||||
|
||||
// MemberChanges represents changes to a repository collaborator's role or permission.
|
||||
type MemberChanges struct {
|
||||
Permission *MemberChangesPermission `json:"permission,omitempty"`
|
||||
RoleName *MemberChangesRoleName `json:"role_name,omitempty"`
|
||||
}
|
||||
|
||||
// MemberEvent is triggered when a user's membership as a collaborator to a repository changes.
|
||||
// The Webhook event name is "member".
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#member
|
||||
type MemberEvent struct {
|
||||
// Action is the action that was performed. Possible value is: "added".
|
||||
Action *string `json:"action,omitempty"`
|
||||
Member *User `json:"member,omitempty"`
|
||||
// Action is the action that was performed. Possible values are:
|
||||
//"added", "edited", "removed".
|
||||
Action *string `json:"action,omitempty"`
|
||||
Member *User `json:"member,omitempty"`
|
||||
Changes *MemberChanges `json:"changes,omitempty"`
|
||||
|
||||
// The following fields are only populated by Webhook events.
|
||||
Repo *Repository `json:"repository,omitempty"`
|
||||
|
|
@ -1327,44 +1388,44 @@ func (h HeadCommit) String() string {
|
|||
|
||||
// PushEventRepository represents the repo object in a PushEvent payload.
|
||||
type PushEventRepository struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
FullName *string `json:"full_name,omitempty"`
|
||||
Owner *User `json:"owner,omitempty"`
|
||||
Private *bool `json:"private,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Fork *bool `json:"fork,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
PushedAt *Timestamp `json:"pushed_at,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
Homepage *string `json:"homepage,omitempty"`
|
||||
PullsURL *string `json:"pulls_url,omitempty"`
|
||||
Size *int `json:"size,omitempty"`
|
||||
StargazersCount *int `json:"stargazers_count,omitempty"`
|
||||
WatchersCount *int `json:"watchers_count,omitempty"`
|
||||
Language *string `json:"language,omitempty"`
|
||||
HasIssues *bool `json:"has_issues,omitempty"`
|
||||
HasDownloads *bool `json:"has_downloads,omitempty"`
|
||||
HasWiki *bool `json:"has_wiki,omitempty"`
|
||||
HasPages *bool `json:"has_pages,omitempty"`
|
||||
ForksCount *int `json:"forks_count,omitempty"`
|
||||
Archived *bool `json:"archived,omitempty"`
|
||||
Disabled *bool `json:"disabled,omitempty"`
|
||||
OpenIssuesCount *int `json:"open_issues_count,omitempty"`
|
||||
DefaultBranch *string `json:"default_branch,omitempty"`
|
||||
MasterBranch *string `json:"master_branch,omitempty"`
|
||||
Organization *string `json:"organization,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
ArchiveURL *string `json:"archive_url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
StatusesURL *string `json:"statuses_url,omitempty"`
|
||||
GitURL *string `json:"git_url,omitempty"`
|
||||
SSHURL *string `json:"ssh_url,omitempty"`
|
||||
CloneURL *string `json:"clone_url,omitempty"`
|
||||
SVNURL *string `json:"svn_url,omitempty"`
|
||||
Topics []string `json:"topics,omitempty"`
|
||||
CustomProperties map[string]string `json:"custom_properties,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
NodeID *string `json:"node_id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
FullName *string `json:"full_name,omitempty"`
|
||||
Owner *User `json:"owner,omitempty"`
|
||||
Private *bool `json:"private,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Fork *bool `json:"fork,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
PushedAt *Timestamp `json:"pushed_at,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
Homepage *string `json:"homepage,omitempty"`
|
||||
PullsURL *string `json:"pulls_url,omitempty"`
|
||||
Size *int `json:"size,omitempty"`
|
||||
StargazersCount *int `json:"stargazers_count,omitempty"`
|
||||
WatchersCount *int `json:"watchers_count,omitempty"`
|
||||
Language *string `json:"language,omitempty"`
|
||||
HasIssues *bool `json:"has_issues,omitempty"`
|
||||
HasDownloads *bool `json:"has_downloads,omitempty"`
|
||||
HasWiki *bool `json:"has_wiki,omitempty"`
|
||||
HasPages *bool `json:"has_pages,omitempty"`
|
||||
ForksCount *int `json:"forks_count,omitempty"`
|
||||
Archived *bool `json:"archived,omitempty"`
|
||||
Disabled *bool `json:"disabled,omitempty"`
|
||||
OpenIssuesCount *int `json:"open_issues_count,omitempty"`
|
||||
DefaultBranch *string `json:"default_branch,omitempty"`
|
||||
MasterBranch *string `json:"master_branch,omitempty"`
|
||||
Organization *string `json:"organization,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
ArchiveURL *string `json:"archive_url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
StatusesURL *string `json:"statuses_url,omitempty"`
|
||||
GitURL *string `json:"git_url,omitempty"`
|
||||
SSHURL *string `json:"ssh_url,omitempty"`
|
||||
CloneURL *string `json:"clone_url,omitempty"`
|
||||
SVNURL *string `json:"svn_url,omitempty"`
|
||||
Topics []string `json:"topics,omitempty"`
|
||||
CustomProperties map[string]interface{} `json:"custom_properties,omitempty"`
|
||||
}
|
||||
|
||||
// PushEventRepoOwner is a basic representation of user/org in a PushEvent payload.
|
||||
|
|
@ -1800,3 +1861,27 @@ type CodeScanningAlertEvent struct {
|
|||
|
||||
Installation *Installation `json:"installation,omitempty"`
|
||||
}
|
||||
|
||||
// SponsorshipEvent represents a sponsorship event in GitHub.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/en/rest/overview/github-event-types?apiVersion=2022-11-28#sponsorshipevent
|
||||
type SponsorshipEvent struct {
|
||||
Action *string `json:"action,omitempty"`
|
||||
EffectiveDate *string `json:"effective_date,omitempty"`
|
||||
Changes *SponsorshipChanges `json:"changes,omitempty"`
|
||||
Repository *Repository `json:"repository,omitempty"`
|
||||
Organization *Organization `json:"organization,omitempty"`
|
||||
Sender *User `json:"sender,omitempty"`
|
||||
Installation *Installation `json:"installation,omitempty"`
|
||||
}
|
||||
|
||||
// SponsorshipChanges represents changes made to the sponsorship.
|
||||
type SponsorshipChanges struct {
|
||||
Tier *SponsorshipTier `json:"tier,omitempty"`
|
||||
PrivacyLevel *string `json:"privacy_level,omitempty"`
|
||||
}
|
||||
|
||||
// SponsorshipTier represents the tier information of a sponsorship.
|
||||
type SponsorshipTier struct {
|
||||
From *string `json:"from,omitempty"`
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -28,7 +28,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
Version = "v60.0.0"
|
||||
Version = "v66.0.0"
|
||||
|
||||
defaultAPIVersion = "2022-11-28"
|
||||
defaultBaseURL = "https://api.github.com/"
|
||||
|
|
@ -170,7 +170,7 @@ type Client struct {
|
|||
UserAgent string
|
||||
|
||||
rateMu sync.Mutex
|
||||
rateLimits [categories]Rate // Rate limits for the client as determined by the most recent API calls.
|
||||
rateLimits [Categories]Rate // Rate limits for the client as determined by the most recent API calls.
|
||||
secondaryRateLimitReset time.Time // Secondary rate limit reset for the client as determined by the most recent API calls.
|
||||
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
|
|
@ -774,7 +774,7 @@ func parseSecondaryRate(r *http.Response) *time.Duration {
|
|||
|
||||
// According to GitHub support, endpoints might return x-ratelimit-reset instead,
|
||||
// as an integer which represents the number of seconds since epoch UTC,
|
||||
// represting the time to resume making requests.
|
||||
// representing the time to resume making requests.
|
||||
if v := r.Header.Get(headerRateReset); v != "" {
|
||||
secondsSinceEpoch, _ := strconv.ParseInt(v, 10, 64) // Error handling is noop.
|
||||
retryAfter := time.Until(time.Unix(secondsSinceEpoch, 0))
|
||||
|
|
@ -804,6 +804,7 @@ type requestContext uint8
|
|||
|
||||
const (
|
||||
bypassRateLimitCheck requestContext = iota
|
||||
SleepUntilPrimaryRateLimitResetWhenRateLimited
|
||||
)
|
||||
|
||||
// BareDo sends an API request and lets you handle the api response. If an error
|
||||
|
|
@ -821,7 +822,7 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro
|
|||
|
||||
req = withContext(ctx, req)
|
||||
|
||||
rateLimitCategory := category(req.Method, req.URL.Path)
|
||||
rateLimitCategory := GetRateLimitCategory(req.Method, req.URL.Path)
|
||||
|
||||
if bypass := ctx.Value(bypassRateLimitCheck); bypass == nil {
|
||||
// If we've hit rate limit, don't make further requests before Reset time.
|
||||
|
|
@ -889,6 +890,15 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro
|
|||
err = aerr
|
||||
}
|
||||
|
||||
rateLimitError, ok := err.(*RateLimitError)
|
||||
if ok && req.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil {
|
||||
if err := sleepUntilResetWithBuffer(req.Context(), rateLimitError.Rate.Reset.Time); err != nil {
|
||||
return response, err
|
||||
}
|
||||
// retry the request once when the rate limit has reset
|
||||
return c.BareDo(context.WithValue(req.Context(), SleepUntilPrimaryRateLimitResetWhenRateLimited, nil), req)
|
||||
}
|
||||
|
||||
// Update the secondary rate limit if we hit it.
|
||||
rerr, ok := err.(*AbuseRateLimitError)
|
||||
if ok && rerr.RetryAfter != nil {
|
||||
|
|
@ -937,7 +947,7 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res
|
|||
// current client state in order to quickly check if *RateLimitError can be immediately returned
|
||||
// from Client.Do, and if so, returns it so that Client.Do can skip making a network API call unnecessarily.
|
||||
// Otherwise it returns nil, and Client.Do should proceed normally.
|
||||
func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rateLimitCategory) *RateLimitError {
|
||||
func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory RateLimitCategory) *RateLimitError {
|
||||
c.rateMu.Lock()
|
||||
rate := c.rateLimits[rateLimitCategory]
|
||||
c.rateMu.Unlock()
|
||||
|
|
@ -950,6 +960,18 @@ func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rat
|
|||
Header: make(http.Header),
|
||||
Body: io.NopCloser(strings.NewReader("")),
|
||||
}
|
||||
|
||||
if req.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil {
|
||||
if err := sleepUntilResetWithBuffer(req.Context(), rate.Reset.Time); err == nil {
|
||||
return nil
|
||||
}
|
||||
return &RateLimitError{
|
||||
Rate: rate,
|
||||
Response: resp,
|
||||
Message: fmt.Sprintf("Context cancelled while waiting for rate limit to reset until %v, not making remote request.", rate.Reset.Time),
|
||||
}
|
||||
}
|
||||
|
||||
return &RateLimitError{
|
||||
Rate: rate,
|
||||
Response: resp,
|
||||
|
|
@ -1303,65 +1325,70 @@ func parseBoolResponse(err error) (bool, error) {
|
|||
return false, err
|
||||
}
|
||||
|
||||
type rateLimitCategory uint8
|
||||
type RateLimitCategory uint8
|
||||
|
||||
const (
|
||||
coreCategory rateLimitCategory = iota
|
||||
searchCategory
|
||||
graphqlCategory
|
||||
integrationManifestCategory
|
||||
sourceImportCategory
|
||||
codeScanningUploadCategory
|
||||
actionsRunnerRegistrationCategory
|
||||
scimCategory
|
||||
dependencySnapshotsCategory
|
||||
codeSearchCategory
|
||||
CoreCategory RateLimitCategory = iota
|
||||
SearchCategory
|
||||
GraphqlCategory
|
||||
IntegrationManifestCategory
|
||||
SourceImportCategory
|
||||
CodeScanningUploadCategory
|
||||
ActionsRunnerRegistrationCategory
|
||||
ScimCategory
|
||||
DependencySnapshotsCategory
|
||||
CodeSearchCategory
|
||||
AuditLogCategory
|
||||
|
||||
categories // An array of this length will be able to contain all rate limit categories.
|
||||
Categories // An array of this length will be able to contain all rate limit categories.
|
||||
)
|
||||
|
||||
// category returns the rate limit category of the endpoint, determined by HTTP method and Request.URL.Path.
|
||||
func category(method, path string) rateLimitCategory {
|
||||
// GetRateLimitCategory returns the rate limit RateLimitCategory of the endpoint, determined by HTTP method and Request.URL.Path.
|
||||
func GetRateLimitCategory(method, path string) RateLimitCategory {
|
||||
switch {
|
||||
// https://docs.github.com/rest/rate-limit#about-rate-limits
|
||||
default:
|
||||
// NOTE: coreCategory is returned for actionsRunnerRegistrationCategory too,
|
||||
// because no API found for this category.
|
||||
return coreCategory
|
||||
return CoreCategory
|
||||
|
||||
// https://docs.github.com/en/rest/search/search#search-code
|
||||
case strings.HasPrefix(path, "/search/code") &&
|
||||
method == http.MethodGet:
|
||||
return codeSearchCategory
|
||||
return CodeSearchCategory
|
||||
|
||||
case strings.HasPrefix(path, "/search/"):
|
||||
return searchCategory
|
||||
return SearchCategory
|
||||
case path == "/graphql":
|
||||
return graphqlCategory
|
||||
return GraphqlCategory
|
||||
case strings.HasPrefix(path, "/app-manifests/") &&
|
||||
strings.HasSuffix(path, "/conversions") &&
|
||||
method == http.MethodPost:
|
||||
return integrationManifestCategory
|
||||
return IntegrationManifestCategory
|
||||
|
||||
// https://docs.github.com/rest/migrations/source-imports#start-an-import
|
||||
case strings.HasPrefix(path, "/repos/") &&
|
||||
strings.HasSuffix(path, "/import") &&
|
||||
method == http.MethodPut:
|
||||
return sourceImportCategory
|
||||
return SourceImportCategory
|
||||
|
||||
// https://docs.github.com/rest/code-scanning#upload-an-analysis-as-sarif-data
|
||||
case strings.HasSuffix(path, "/code-scanning/sarifs"):
|
||||
return codeScanningUploadCategory
|
||||
return CodeScanningUploadCategory
|
||||
|
||||
// https://docs.github.com/enterprise-cloud@latest/rest/scim
|
||||
case strings.HasPrefix(path, "/scim/"):
|
||||
return scimCategory
|
||||
return ScimCategory
|
||||
|
||||
// https://docs.github.com/en/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
case strings.HasPrefix(path, "/repos/") &&
|
||||
strings.HasSuffix(path, "/dependency-graph/snapshots") &&
|
||||
method == http.MethodPost:
|
||||
return dependencySnapshotsCategory
|
||||
return DependencySnapshotsCategory
|
||||
|
||||
// https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#get-the-audit-log-for-an-organization
|
||||
case strings.HasSuffix(path, "/audit-log"):
|
||||
return AuditLogCategory
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1509,6 +1536,20 @@ func formatRateReset(d time.Duration) string {
|
|||
return fmt.Sprintf("[rate reset in %v]", timeString)
|
||||
}
|
||||
|
||||
func sleepUntilResetWithBuffer(ctx context.Context, reset time.Time) error {
|
||||
buffer := time.Second
|
||||
timer := time.NewTimer(time.Until(reset) + buffer)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
if !timer.Stop() {
|
||||
<-timer.C
|
||||
}
|
||||
return ctx.Err()
|
||||
case <-timer.C:
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// When using roundTripWithOptionalFollowRedirect, note that it
|
||||
// is the responsibility of the caller to close the response body.
|
||||
func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u string, maxRedirects int, opts ...RequestOption) (*http.Response, error) {
|
||||
|
|
@ -57,6 +57,7 @@ var (
|
|||
"dependabot_alert": &DependabotAlertEvent{},
|
||||
"deploy_key": &DeployKeyEvent{},
|
||||
"deployment": &DeploymentEvent{},
|
||||
"deployment_review": &DeploymentReviewEvent{},
|
||||
"deployment_status": &DeploymentStatusEvent{},
|
||||
"deployment_protection_rule": &DeploymentProtectionRuleEvent{},
|
||||
"discussion": &DiscussionEvent{},
|
||||
|
|
@ -102,6 +103,7 @@ var (
|
|||
"secret_scanning_alert": &SecretScanningAlertEvent{},
|
||||
"security_advisory": &SecurityAdvisoryEvent{},
|
||||
"security_and_analysis": &SecurityAndAnalysisEvent{},
|
||||
"sponsorship": &SponsorshipEvent{},
|
||||
"star": &StarEvent{},
|
||||
"status": &StatusEvent{},
|
||||
"team": &TeamEvent{},
|
||||
|
|
@ -17,11 +17,11 @@ type MetaService service
|
|||
|
||||
// APIMeta represents metadata about the GitHub API.
|
||||
type APIMeta struct {
|
||||
// An Array of IP addresses in CIDR format specifying the addresses
|
||||
// An array of IP addresses in CIDR format specifying the addresses
|
||||
// that incoming service hooks will originate from on GitHub.com.
|
||||
Hooks []string `json:"hooks,omitempty"`
|
||||
|
||||
// An Array of IP addresses in CIDR format specifying the Git servers
|
||||
// An array of IP addresses in CIDR format specifying the Git servers
|
||||
// for GitHub.com.
|
||||
Git []string `json:"git,omitempty"`
|
||||
|
||||
|
|
@ -40,10 +40,14 @@ type APIMeta struct {
|
|||
// which serve GitHub Pages websites.
|
||||
Pages []string `json:"pages,omitempty"`
|
||||
|
||||
// An Array of IP addresses specifying the addresses that source imports
|
||||
// An array of IP addresses specifying the addresses that source imports
|
||||
// will originate from on GitHub.com.
|
||||
Importer []string `json:"importer,omitempty"`
|
||||
|
||||
// An array of IP addresses specifying the addresses that source imports
|
||||
// will originate from on GitHub Enterprise Cloud.
|
||||
GithubEnterpriseImporter []string `json:"github_enterprise_importer,omitempty"`
|
||||
|
||||
// An array of IP addresses in CIDR format specifying the IP addresses
|
||||
// GitHub Actions will originate from.
|
||||
Actions []string `json:"actions,omitempty"`
|
||||
|
|
@ -65,6 +69,26 @@ type APIMeta struct {
|
|||
// An array of IP addresses in CIDR format specifying the addresses
|
||||
// which serve GitHub APIs.
|
||||
API []string `json:"api,omitempty"`
|
||||
|
||||
// GitHub services and their associated domains. Note that many of these domains
|
||||
// are represented as wildcards (e.g. "*.github.com").
|
||||
Domains *APIMetaDomains `json:"domains,omitempty"`
|
||||
}
|
||||
|
||||
// APIMetaDomains represents the domains associated with GitHub services.
|
||||
type APIMetaDomains struct {
|
||||
Website []string `json:"website,omitempty"`
|
||||
Codespaces []string `json:"codespaces,omitempty"`
|
||||
Copilot []string `json:"copilot,omitempty"`
|
||||
Packages []string `json:"packages,omitempty"`
|
||||
Actions []string `json:"actions,omitempty"`
|
||||
ArtifactAttestations *APIMetaArtifactAttestations `json:"artifact_attestations,omitempty"`
|
||||
}
|
||||
|
||||
// APIMetaArtifactAttestations represents the artifact attestation services domains.
|
||||
type APIMetaArtifactAttestations struct {
|
||||
TrustDomain string `json:"trust_domain,omitempty"`
|
||||
Services []string `json:"services,omitempty"`
|
||||
}
|
||||
|
||||
// Get returns information about GitHub.com, the service. Or, if you access
|
||||
|
|
@ -76,7 +76,7 @@ type Import struct {
|
|||
// Contact GitHub support for more information.
|
||||
// detection_needs_auth - the importer requires authentication for
|
||||
// the originating repository to continue detection. Make an
|
||||
// UpdatImport request, and include VCSUsername and
|
||||
// UpdateImport request, and include VCSUsername and
|
||||
// VCSPassword.
|
||||
// detection_found_nothing - the importer didn't recognize any
|
||||
// source control at the URL.
|
||||
|
|
@ -55,13 +55,23 @@ type CredentialAuthorization struct {
|
|||
AuthorizedCredentialExpiresAt *Timestamp `json:"authorized_credential_expires_at,omitempty"`
|
||||
}
|
||||
|
||||
// CredentialAuthorizationsListOptions adds the Login option as supported by the
|
||||
// list SAML SSO authorizations for organizations endpoint alongside paging options
|
||||
// such as Page and PerPage.
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization
|
||||
type CredentialAuthorizationsListOptions struct {
|
||||
ListOptions
|
||||
// For credentials authorizations for an organization, limit the list of authorizations to a specific login (aka github username)
|
||||
Login string `url:"login,omitempty"`
|
||||
}
|
||||
|
||||
// ListCredentialAuthorizations lists credentials authorized through SAML SSO
|
||||
// for a given organization. Only available with GitHub Enterprise Cloud.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/credential-authorizations
|
||||
func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, org string, opts *ListOptions) ([]*CredentialAuthorization, *Response, error) {
|
||||
func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, org string, opts *CredentialAuthorizationsListOptions) ([]*CredentialAuthorization, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/credential-authorizations", org)
|
||||
u, err := addOptions(u, opts)
|
||||
if err != nil {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The go-github AUTHORS. All rights reserved.
|
||||
// Copyright 2024 The go-github AUTHORS. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
|
@ -20,11 +20,22 @@ type OrganizationCustomRepoRoles struct {
|
|||
// See https://docs.github.com/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization
|
||||
// for more information.
|
||||
type CustomRepoRoles struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
BaseRole *string `json:"base_role,omitempty"`
|
||||
Permissions []string `json:"permissions,omitempty"`
|
||||
Org *Organization `json:"organization,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
// CreateOrUpdateCustomRepoRoleOptions represents options required to create or update a custom repository role.
|
||||
type CreateOrUpdateCustomRepoRoleOptions struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
BaseRole *string `json:"base_role,omitempty"`
|
||||
Permissions []string `json:"permissions,omitempty"`
|
||||
Permissions []string `json:"permissions"`
|
||||
}
|
||||
|
||||
// ListCustomRepoRoles lists the custom repository roles available in this organization.
|
||||
|
|
@ -50,21 +61,13 @@ func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org stri
|
|||
return customRepoRoles, resp, nil
|
||||
}
|
||||
|
||||
// CreateOrUpdateCustomRoleOptions represents options required to create or update a custom repository role.
|
||||
type CreateOrUpdateCustomRoleOptions struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
BaseRole *string `json:"base_role,omitempty"`
|
||||
Permissions []string `json:"permissions,omitempty"`
|
||||
}
|
||||
|
||||
// CreateCustomRepoRole creates a custom repository role in this organization.
|
||||
// In order to create custom repository roles in an organization, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#create-a-custom-repository-role
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/custom-repository-roles
|
||||
func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, opts *CreateOrUpdateCustomRoleOptions) (*CustomRepoRoles, *Response, error) {
|
||||
func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, opts *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/custom-repository-roles", org)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opts)
|
||||
|
|
@ -87,7 +90,7 @@ func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org str
|
|||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#update-a-custom-repository-role
|
||||
//
|
||||
//meta:operation PATCH /orgs/{org}/custom-repository-roles/{role_id}
|
||||
func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org, roleID string, opts *CreateOrUpdateCustomRoleOptions) (*CustomRepoRoles, *Response, error) {
|
||||
func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org string, roleID int64, opts *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID)
|
||||
|
||||
req, err := s.client.NewRequest("PATCH", u, opts)
|
||||
|
|
@ -110,7 +113,7 @@ func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org, ro
|
|||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#delete-a-custom-repository-role
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/custom-repository-roles/{role_id}
|
||||
func (s *OrganizationsService) DeleteCustomRepoRole(ctx context.Context, org, roleID string) (*Response, error) {
|
||||
func (s *OrganizationsService) DeleteCustomRepoRole(ctx context.Context, org string, roleID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
|
|
@ -151,6 +151,20 @@ func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user strin
|
|||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// CancelInvite cancels an organization invitation.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/members#cancel-an-organization-invitation
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/invitations/{invitation_id}
|
||||
func (s *OrganizationsService) CancelInvite(ctx context.Context, org string, invitationID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/invitations/%v", org, invitationID)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// PublicizeMembership publicizes a user's membership in an organization. (A
|
||||
// user cannot publicize the membership for another user.)
|
||||
//
|
||||
|
|
@ -395,7 +409,7 @@ func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org,
|
|||
return orgInvitationTeams, resp, nil
|
||||
}
|
||||
|
||||
// ListFailedOrgInvitations returns a list of failed inviatations.
|
||||
// ListFailedOrgInvitations returns a list of failed invitations.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/members#list-failed-organization-invitations
|
||||
//
|
||||
295
vendor/github.com/google/go-github/v66/github/orgs_organization_roles.go
generated
vendored
Normal file
295
vendor/github.com/google/go-github/v66/github/orgs_organization_roles.go
generated
vendored
Normal file
|
|
@ -0,0 +1,295 @@
|
|||
// Copyright 2022 The go-github AUTHORS. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// OrganizationCustomRoles represents custom organization roles available in specified organization.
|
||||
type OrganizationCustomRoles struct {
|
||||
TotalCount *int `json:"total_count,omitempty"`
|
||||
CustomRepoRoles []*CustomOrgRoles `json:"roles,omitempty"`
|
||||
}
|
||||
|
||||
// CustomOrgRoles represents custom organization role available in specified organization.
|
||||
type CustomOrgRoles struct {
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Permissions []string `json:"permissions,omitempty"`
|
||||
Org *Organization `json:"organization,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
Source *string `json:"source,omitempty"`
|
||||
BaseRole *string `json:"base_role,omitempty"`
|
||||
}
|
||||
|
||||
// CreateOrUpdateOrgRoleOptions represents options required to create or update a custom organization role.
|
||||
type CreateOrUpdateOrgRoleOptions struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Permissions []string `json:"permissions"`
|
||||
BaseRole *string `json:"base_role,omitempty"`
|
||||
}
|
||||
|
||||
// ListRoles lists the custom roles available in this organization.
|
||||
// In order to see custom roles in an organization, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#get-all-organization-roles-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/organization-roles
|
||||
func (s *OrganizationsService) ListRoles(ctx context.Context, org string) (*OrganizationCustomRoles, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles", org)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
customRepoRoles := new(OrganizationCustomRoles)
|
||||
resp, err := s.client.Do(ctx, req, customRepoRoles)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return customRepoRoles, resp, nil
|
||||
}
|
||||
|
||||
// GetOrgRole gets an organization role in this organization.
|
||||
// In order to get organization roles in an organization, the authenticated user must be an organization owner, or have access via an organization role.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#get-an-organization-role
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/organization-roles/{role_id}
|
||||
func (s *OrganizationsService) GetOrgRole(ctx context.Context, org string, roleID int64) (*CustomOrgRoles, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
resultingRole := new(CustomOrgRoles)
|
||||
resp, err := s.client.Do(ctx, req, resultingRole)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return resultingRole, resp, err
|
||||
}
|
||||
|
||||
// CreateCustomOrgRole creates a custom role in this organization.
|
||||
// In order to create custom roles in an organization, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#create-a-custom-organization-role
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/organization-roles
|
||||
func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org string, opts *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles", org)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
resultingRole := new(CustomOrgRoles)
|
||||
resp, err := s.client.Do(ctx, req, resultingRole)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return resultingRole, resp, err
|
||||
}
|
||||
|
||||
// UpdateCustomOrgRole updates a custom role in this organization.
|
||||
// In order to update custom roles in an organization, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#update-a-custom-organization-role
|
||||
//
|
||||
//meta:operation PATCH /orgs/{org}/organization-roles/{role_id}
|
||||
func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org string, roleID int64, opts *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID)
|
||||
|
||||
req, err := s.client.NewRequest("PATCH", u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
resultingRole := new(CustomOrgRoles)
|
||||
resp, err := s.client.Do(ctx, req, resultingRole)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return resultingRole, resp, err
|
||||
}
|
||||
|
||||
// DeleteCustomOrgRole deletes an existing custom role in this organization.
|
||||
// In order to delete custom roles in an organization, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#delete-a-custom-organization-role
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/organization-roles/{role_id}
|
||||
func (s *OrganizationsService) DeleteCustomOrgRole(ctx context.Context, org string, roleID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resultingRole := new(CustomOrgRoles)
|
||||
resp, err := s.client.Do(ctx, req, resultingRole)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// AssignOrgRoleToTeam assigns an existing organization role to a team in this organization.
|
||||
// In order to assign organization roles in an organization, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-team
|
||||
//
|
||||
//meta:operation PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}
|
||||
func (s *OrganizationsService) AssignOrgRoleToTeam(ctx context.Context, org, teamSlug string, roleID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles/teams/%v/%v", org, teamSlug, roleID)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := s.client.Do(ctx, req, nil)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// RemoveOrgRoleFromTeam removes an existing organization role assignment from a team in this organization.
|
||||
// In order to remove organization role assignments in an organization, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-team
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}
|
||||
func (s *OrganizationsService) RemoveOrgRoleFromTeam(ctx context.Context, org, teamSlug string, roleID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles/teams/%v/%v", org, teamSlug, roleID)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := s.client.Do(ctx, req, nil)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// AssignOrgRoleToUser assigns an existing organization role to a user in this organization.
|
||||
// In order to assign organization roles in an organization, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-user
|
||||
//
|
||||
//meta:operation PUT /orgs/{org}/organization-roles/users/{username}/{role_id}
|
||||
func (s *OrganizationsService) AssignOrgRoleToUser(ctx context.Context, org, username string, roleID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles/users/%v/%v", org, username, roleID)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := s.client.Do(ctx, req, nil)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// RemoveOrgRoleFromUser removes an existing organization role assignment from a user in this organization.
|
||||
// In order to remove organization role assignments in an organization, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-user
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/organization-roles/users/{username}/{role_id}
|
||||
func (s *OrganizationsService) RemoveOrgRoleFromUser(ctx context.Context, org, username string, roleID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles/users/%v/%v", org, username, roleID)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := s.client.Do(ctx, req, nil)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ListTeamsAssignedToOrgRole returns all teams assigned to a specific organization role.
|
||||
// In order to list teams assigned to an organization role, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#list-teams-that-are-assigned-to-an-organization-role
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/organization-roles/{role_id}/teams
|
||||
func (s *OrganizationsService) ListTeamsAssignedToOrgRole(ctx context.Context, org string, roleID int64, opts *ListOptions) ([]*Team, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles/%v/teams", org, roleID)
|
||||
u, err := addOptions(u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var teams []*Team
|
||||
resp, err := s.client.Do(ctx, req, &teams)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return teams, resp, nil
|
||||
}
|
||||
|
||||
// ListUsersAssignedToOrgRole returns all users assigned to a specific organization role.
|
||||
// In order to list users assigned to an organization role, the authenticated user must be an organization owner.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#list-users-that-are-assigned-to-an-organization-role
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/organization-roles/{role_id}/users
|
||||
func (s *OrganizationsService) ListUsersAssignedToOrgRole(ctx context.Context, org string, roleID int64, opts *ListOptions) ([]*User, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/organization-roles/%v/users", org, roleID)
|
||||
u, err := addOptions(u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var users []*User
|
||||
resp, err := s.client.Do(ctx, req, &users)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return users, resp, nil
|
||||
}
|
||||
167
vendor/github.com/google/go-github/v66/github/orgs_personal_access_tokens.go
generated
vendored
Normal file
167
vendor/github.com/google/go-github/v66/github/orgs_personal_access_tokens.go
generated
vendored
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
// Copyright 2023 The go-github AUTHORS. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// PersonalAccessToken represents the minimal representation of an organization programmatic access grant.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/en/rest/orgs/personal-access-tokens?apiVersion=2022-11-28
|
||||
type PersonalAccessToken struct {
|
||||
// "Unique identifier of the fine-grained personal access token.
|
||||
// The `pat_id` used to get details about an approved fine-grained personal access token.
|
||||
ID *int64 `json:"id"`
|
||||
|
||||
// Owner is the GitHub user associated with the token.
|
||||
Owner *User `json:"owner"`
|
||||
|
||||
// RepositorySelection is the type of repository selection requested.
|
||||
// Possible values are: "none", "all", "subset".
|
||||
RepositorySelection *string `json:"repository_selection"`
|
||||
|
||||
// URL to the list of repositories the fine-grained personal access token can access.
|
||||
// Only follow when `repository_selection` is `subset`.
|
||||
RepositoriesURL *string `json:"repositories_url"`
|
||||
|
||||
// Permissions are the permissions requested, categorized by type.
|
||||
Permissions *PersonalAccessTokenPermissions `json:"permissions"`
|
||||
|
||||
// Date and time when the fine-grained personal access token was approved to access the organization.
|
||||
AccessGrantedAt *Timestamp `json:"access_granted_at"`
|
||||
|
||||
// Whether the associated fine-grained personal access token has expired.
|
||||
TokenExpired *bool `json:"token_expired"`
|
||||
|
||||
// Date and time when the associated fine-grained personal access token expires.
|
||||
TokenExpiresAt *Timestamp `json:"token_expires_at"`
|
||||
|
||||
// Date and time when the associated fine-grained personal access token was last used for authentication.
|
||||
TokenLastUsedAt *Timestamp `json:"token_last_used_at"`
|
||||
}
|
||||
|
||||
// ListFineGrainedPATOptions specifies optional parameters to ListFineGrainedPersonalAccessTokens.
|
||||
type ListFineGrainedPATOptions struct {
|
||||
// The property by which to sort the results.
|
||||
// Default: created_at
|
||||
// Value: created_at
|
||||
Sort string `url:"sort,omitempty"`
|
||||
|
||||
// The direction to sort the results by.
|
||||
// Default: desc
|
||||
// Value: asc, desc
|
||||
Direction string `url:"direction,omitempty"`
|
||||
|
||||
// A list of owner usernames to use to filter the results.
|
||||
Owner []string `url:"-"`
|
||||
|
||||
// The name of the repository to use to filter the results.
|
||||
Repository string `url:"repository,omitempty"`
|
||||
|
||||
// The permission to use to filter the results.
|
||||
Permission string `url:"permission,omitempty"`
|
||||
|
||||
// Only show fine-grained personal access tokens used before the given time.
|
||||
// This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
||||
LastUsedBefore string `url:"last_used_before,omitempty"`
|
||||
|
||||
// Only show fine-grained personal access tokens used after the given time.
|
||||
// This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
|
||||
LastUsedAfter string `url:"last_used_after,omitempty"`
|
||||
|
||||
ListOptions
|
||||
}
|
||||
|
||||
// ListFineGrainedPersonalAccessTokens lists approved fine-grained personal access tokens owned by organization members that can access organization resources.
|
||||
// Only GitHub Apps can call this API, using the `Personal access tokens` organization permissions (read).
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens#list-fine-grained-personal-access-tokens-with-access-to-organization-resources
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/personal-access-tokens
|
||||
func (s *OrganizationsService) ListFineGrainedPersonalAccessTokens(ctx context.Context, org string, opts *ListFineGrainedPATOptions) ([]*PersonalAccessToken, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/personal-access-tokens", org)
|
||||
// The `owner` parameter is a special case that uses the `owner[]=...` format and needs a custom function to format it correctly.
|
||||
u, err := addListFineGrainedPATOptions(u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var pats []*PersonalAccessToken
|
||||
|
||||
resp, err := s.client.Do(ctx, req, &pats)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return pats, resp, nil
|
||||
}
|
||||
|
||||
// ReviewPersonalAccessTokenRequestOptions specifies the parameters to the ReviewPersonalAccessTokenRequest method.
|
||||
type ReviewPersonalAccessTokenRequestOptions struct {
|
||||
Action string `json:"action"`
|
||||
Reason *string `json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// ReviewPersonalAccessTokenRequest approves or denies a pending request to access organization resources via a fine-grained personal access token.
|
||||
// Only GitHub Apps can call this API, using the `organization_personal_access_token_requests: write` permission.
|
||||
// `action` can be one of `approve` or `deny`.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/personal-access-token-requests/{pat_request_id}
|
||||
func (s *OrganizationsService) ReviewPersonalAccessTokenRequest(ctx context.Context, org string, requestID int64, opts ReviewPersonalAccessTokenRequestOptions) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/personal-access-token-requests/%v", org, requestID)
|
||||
|
||||
req, err := s.client.NewRequest(http.MethodPost, u, &opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.client.Do(ctx, req, nil)
|
||||
}
|
||||
|
||||
// addListFineGrainedPATOptions adds the owner parameter to the URL query string with the correct format if it is set.
|
||||
//
|
||||
// GitHub API expects the owner parameter to be a list of strings in the `owner[]=...` format.
|
||||
// For multiple owner values, the owner parameter is repeated in the query string.
|
||||
//
|
||||
// Example:
|
||||
// owner[]=user1&owner[]=user2
|
||||
// This will filter the results to only include fine-grained personal access tokens owned by `user1` and `user2`.
|
||||
//
|
||||
// This function ensures the owner parameter is formatted correctly in the URL query string.
|
||||
func addListFineGrainedPATOptions(s string, opts *ListFineGrainedPATOptions) (string, error) {
|
||||
u, err := addOptions(s, opts)
|
||||
if err != nil {
|
||||
return s, err
|
||||
}
|
||||
|
||||
if len(opts.Owner) > 0 {
|
||||
ownerVals := make([]string, len(opts.Owner))
|
||||
for i, owner := range opts.Owner {
|
||||
ownerVals[i] = fmt.Sprintf("owner[]=%s", url.QueryEscape(owner))
|
||||
}
|
||||
ownerQuery := strings.Join(ownerVals, "&")
|
||||
|
||||
if strings.Contains(u, "?") {
|
||||
u += "&" + ownerQuery
|
||||
} else {
|
||||
u += "?" + ownerQuery
|
||||
}
|
||||
}
|
||||
|
||||
return u, nil
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ package github
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
|
|
@ -15,12 +16,19 @@ type CustomProperty struct {
|
|||
// PropertyName is required for most endpoints except when calling CreateOrUpdateCustomProperty;
|
||||
// where this is sent in the path and thus can be omitted.
|
||||
PropertyName *string `json:"property_name,omitempty"`
|
||||
// Possible values for ValueType are: string, single_select
|
||||
ValueType string `json:"value_type"`
|
||||
Required *bool `json:"required,omitempty"`
|
||||
DefaultValue *string `json:"default_value,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
// The type of the value for the property. Can be one of: string, single_select.
|
||||
ValueType string `json:"value_type"`
|
||||
// Whether the property is required.
|
||||
Required *bool `json:"required,omitempty"`
|
||||
// Default value of the property.
|
||||
DefaultValue *string `json:"default_value,omitempty"`
|
||||
// Short description of the property.
|
||||
Description *string `json:"description,omitempty"`
|
||||
// An ordered list of the allowed values of the property. The property can have up to 200
|
||||
// allowed values.
|
||||
AllowedValues []string `json:"allowed_values,omitempty"`
|
||||
// Who can edit the values of the property. Can be one of: org_actors, org_and_repo_actors, nil (null).
|
||||
ValuesEditableBy *string `json:"values_editable_by,omitempty"`
|
||||
}
|
||||
|
||||
// RepoCustomPropertyValue represents a repository custom property value.
|
||||
|
|
@ -33,8 +41,42 @@ type RepoCustomPropertyValue struct {
|
|||
|
||||
// CustomPropertyValue represents a custom property value.
|
||||
type CustomPropertyValue struct {
|
||||
PropertyName string `json:"property_name"`
|
||||
Value *string `json:"value,omitempty"`
|
||||
PropertyName string `json:"property_name"`
|
||||
Value interface{} `json:"value"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||
// This helps us handle the fact that Value can be either a string, []string, or nil.
|
||||
func (cpv *CustomPropertyValue) UnmarshalJSON(data []byte) error {
|
||||
type aliasCustomPropertyValue CustomPropertyValue
|
||||
aux := &struct {
|
||||
*aliasCustomPropertyValue
|
||||
}{
|
||||
aliasCustomPropertyValue: (*aliasCustomPropertyValue)(cpv),
|
||||
}
|
||||
if err := json.Unmarshal(data, &aux); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch v := aux.Value.(type) {
|
||||
case nil:
|
||||
cpv.Value = nil
|
||||
case string:
|
||||
cpv.Value = v
|
||||
case []interface{}:
|
||||
strSlice := make([]string, len(v))
|
||||
for i, item := range v {
|
||||
if str, ok := item.(string); ok {
|
||||
strSlice[i] = str
|
||||
} else {
|
||||
return fmt.Errorf("non-string value in string array")
|
||||
}
|
||||
}
|
||||
cpv.Value = strSlice
|
||||
default:
|
||||
return fmt.Errorf("unexpected value type: %T", v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetAllCustomProperties gets all custom properties that are defined for the specified organization.
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue