From 812a9daab9d33a2762382ecabfd7517aaf4633d3 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 26 Oct 2021 15:19:21 +0800 Subject: [PATCH] Upgrade go-github to v39 (#17437) --- go.mod | 3 +- go.sum | 4 +- modules/migrations/error.go | 2 +- modules/migrations/github.go | 2 +- .../google/go-github/{v37 => v39}/AUTHORS | 22 + .../google/go-github/{v37 => v39}/LICENSE | 0 .../go-github/{v37 => v39}/github/actions.go | 0 .../{v37 => v39}/github/actions_artifacts.go | 0 .../github/actions_runner_groups.go | 14 +- .../{v37 => v39}/github/actions_runners.go | 59 + .../{v37 => v39}/github/actions_secrets.go | 2 +- .../github/actions_workflow_jobs.go | 3 +- .../github/actions_workflow_runs.go | 61 +- .../{v37 => v39}/github/actions_workflows.go | 0 .../go-github/{v37 => v39}/github/activity.go | 0 .../{v37 => v39}/github/activity_events.go | 0 .../github/activity_notifications.go | 2 +- .../{v37 => v39}/github/activity_star.go | 0 .../{v37 => v39}/github/activity_watching.go | 0 .../go-github/{v37 => v39}/github/admin.go | 0 .../{v37 => v39}/github/admin_orgs.go | 0 .../{v37 => v39}/github/admin_stats.go | 0 .../{v37 => v39}/github/admin_users.go | 0 .../go-github/{v37 => v39}/github/apps.go | 4 + .../google/go-github/v39/github/apps_hooks.go | 48 + .../{v37 => v39}/github/apps_installation.go | 0 .../{v37 => v39}/github/apps_manifest.go | 1 + .../{v37 => v39}/github/apps_marketplace.go | 0 .../{v37 => v39}/github/authorizations.go | 0 .../go-github/{v37 => v39}/github/billing.go | 0 .../go-github/{v37 => v39}/github/checks.go | 2 + .../{v37 => v39}/github/code-scanning.go | 68 +- .../go-github/{v37 => v39}/github/doc.go | 27 +- .../{v37 => v39}/github/enterprise.go | 0 .../github/enterprise_actions_runners.go | 0 .../github/enterprise_audit_log.go | 0 .../go-github/{v37 => v39}/github/event.go | 4 + .../{v37 => v39}/github/event_types.go | 78 +- .../go-github/{v37 => v39}/github/gists.go | 0 .../{v37 => v39}/github/gists_comments.go | 0 .../go-github/{v37 => v39}/github/git.go | 0 .../{v37 => v39}/github/git_blobs.go | 0 .../{v37 => v39}/github/git_commits.go | 0 .../go-github/{v37 => v39}/github/git_refs.go | 0 .../go-github/{v37 => v39}/github/git_tags.go | 0 .../{v37 => v39}/github/git_trees.go | 0 .../{v37 => v39}/github/github-accessors.go | 1130 ++++++++++++++++- .../go-github/{v37 => v39}/github/github.go | 65 +- .../{v37 => v39}/github/gitignore.go | 0 .../{v37 => v39}/github/interactions.go | 0 .../{v37 => v39}/github/interactions_orgs.go | 0 .../{v37 => v39}/github/interactions_repos.go | 0 .../{v37 => v39}/github/issue_import.go | 0 .../go-github/{v37 => v39}/github/issues.go | 0 .../{v37 => v39}/github/issues_assignees.go | 0 .../{v37 => v39}/github/issues_comments.go | 0 .../{v37 => v39}/github/issues_events.go | 0 .../{v37 => v39}/github/issues_labels.go | 0 .../{v37 => v39}/github/issues_milestones.go | 0 .../{v37 => v39}/github/issues_timeline.go | 0 .../go-github/{v37 => v39}/github/licenses.go | 0 .../go-github/{v37 => v39}/github/messages.go | 145 ++- .../{v37 => v39}/github/migrations.go | 0 .../github/migrations_source_import.go | 0 .../{v37 => v39}/github/migrations_user.go | 0 .../go-github/{v37 => v39}/github/misc.go | 0 .../go-github/{v37 => v39}/github/orgs.go | 0 .../github/orgs_actions_allowed.go | 0 .../github/orgs_actions_permissions.go | 0 .../{v37 => v39}/github/orgs_audit_log.go | 3 + .../{v37 => v39}/github/orgs_hooks.go | 0 .../v39/github/orgs_hooks_deliveries.go | 73 ++ .../{v37 => v39}/github/orgs_members.go | 0 .../github/orgs_outside_collaborators.go | 0 .../go-github/v39/github/orgs_packages.go | 149 +++ .../{v37 => v39}/github/orgs_projects.go | 0 .../github/orgs_users_blocking.go | 0 .../go-github/{v37 => v39}/github/packages.go | 78 +- .../go-github/{v37 => v39}/github/projects.go | 0 .../go-github/{v37 => v39}/github/pulls.go | 0 .../{v37 => v39}/github/pulls_comments.go | 0 .../{v37 => v39}/github/pulls_reviewers.go | 0 .../{v37 => v39}/github/pulls_reviews.go | 24 - .../{v37 => v39}/github/reactions.go | 0 .../go-github/{v37 => v39}/github/repos.go | 50 + .../go-github/v39/github/repos_autolinks.go | 102 ++ .../github/repos_collaborators.go | 0 .../{v37 => v39}/github/repos_comments.go | 0 .../{v37 => v39}/github/repos_commits.go | 12 +- .../github/repos_community_health.go | 17 +- .../{v37 => v39}/github/repos_contents.go | 8 +- .../{v37 => v39}/github/repos_deployments.go | 0 .../{v37 => v39}/github/repos_environments.go | 0 .../{v37 => v39}/github/repos_forks.go | 0 .../{v37 => v39}/github/repos_hooks.go | 0 .../v39/github/repos_hooks_deliveries.go | 117 ++ .../{v37 => v39}/github/repos_invitations.go | 0 .../{v37 => v39}/github/repos_keys.go | 0 .../{v37 => v39}/github/repos_merging.go | 0 .../{v37 => v39}/github/repos_pages.go | 0 .../github/repos_prereceive_hooks.go | 0 .../{v37 => v39}/github/repos_projects.go | 0 .../{v37 => v39}/github/repos_releases.go | 36 + .../{v37 => v39}/github/repos_stats.go | 0 .../{v37 => v39}/github/repos_statuses.go | 3 + .../{v37 => v39}/github/repos_traffic.go | 0 .../google/go-github/v39/github/scim.go | 163 +++ .../go-github/{v37 => v39}/github/search.go | 0 .../go-github/{v37 => v39}/github/strings.go | 0 .../go-github/{v37 => v39}/github/teams.go | 0 .../github/teams_discussion_comments.go | 0 .../{v37 => v39}/github/teams_discussions.go | 0 .../{v37 => v39}/github/teams_members.go | 0 .../{v37 => v39}/github/timestamp.go | 0 .../go-github/{v37 => v39}/github/users.go | 0 .../github/users_administration.go | 0 .../{v37 => v39}/github/users_blocking.go | 0 .../{v37 => v39}/github/users_emails.go | 0 .../{v37 => v39}/github/users_followers.go | 0 .../{v37 => v39}/github/users_gpg_keys.go | 1 + .../{v37 => v39}/github/users_keys.go | 0 .../go-github/v39/github/users_packages.go | 207 +++ .../{v37 => v39}/github/users_projects.go | 0 .../{v37 => v39}/github/with_appengine.go | 0 .../{v37 => v39}/github/without_appengine.go | 0 vendor/modules.txt | 5 +- 126 files changed, 2594 insertions(+), 200 deletions(-) rename vendor/github.com/google/go-github/{v37 => v39}/AUTHORS (94%) rename vendor/github.com/google/go-github/{v37 => v39}/LICENSE (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/actions.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/actions_artifacts.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/actions_runner_groups.go (95%) rename vendor/github.com/google/go-github/{v37 => v39}/github/actions_runners.go (84%) rename vendor/github.com/google/go-github/{v37 => v39}/github/actions_secrets.go (99%) rename vendor/github.com/google/go-github/{v37 => v39}/github/actions_workflow_jobs.go (97%) rename vendor/github.com/google/go-github/{v37 => v39}/github/actions_workflow_runs.go (79%) rename vendor/github.com/google/go-github/{v37 => v39}/github/actions_workflows.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/activity.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/activity_events.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/activity_notifications.go (99%) rename vendor/github.com/google/go-github/{v37 => v39}/github/activity_star.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/activity_watching.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/admin.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/admin_orgs.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/admin_stats.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/admin_users.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/apps.go (98%) create mode 100644 vendor/github.com/google/go-github/v39/github/apps_hooks.go rename vendor/github.com/google/go-github/{v37 => v39}/github/apps_installation.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/apps_manifest.go (96%) rename vendor/github.com/google/go-github/{v37 => v39}/github/apps_marketplace.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/authorizations.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/billing.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/checks.go (99%) rename vendor/github.com/google/go-github/{v37 => v39}/github/code-scanning.go (55%) rename vendor/github.com/google/go-github/{v37 => v39}/github/doc.go (88%) rename vendor/github.com/google/go-github/{v37 => v39}/github/enterprise.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/enterprise_actions_runners.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/enterprise_audit_log.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/event.go (96%) rename vendor/github.com/google/go-github/{v37 => v39}/github/event_types.go (93%) rename vendor/github.com/google/go-github/{v37 => v39}/github/gists.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/gists_comments.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/git.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/git_blobs.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/git_commits.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/git_refs.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/git_tags.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/git_trees.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/github-accessors.go (93%) rename vendor/github.com/google/go-github/{v37 => v39}/github/github.go (96%) rename vendor/github.com/google/go-github/{v37 => v39}/github/gitignore.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/interactions.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/interactions_orgs.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/interactions_repos.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/issue_import.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/issues.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/issues_assignees.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/issues_comments.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/issues_events.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/issues_labels.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/issues_milestones.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/issues_timeline.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/licenses.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/messages.go (80%) rename vendor/github.com/google/go-github/{v37 => v39}/github/migrations.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/migrations_source_import.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/migrations_user.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/misc.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/orgs.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/orgs_actions_allowed.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/orgs_actions_permissions.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/orgs_audit_log.go (97%) rename vendor/github.com/google/go-github/{v37 => v39}/github/orgs_hooks.go (100%) create mode 100644 vendor/github.com/google/go-github/v39/github/orgs_hooks_deliveries.go rename vendor/github.com/google/go-github/{v37 => v39}/github/orgs_members.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/orgs_outside_collaborators.go (100%) create mode 100644 vendor/github.com/google/go-github/v39/github/orgs_packages.go rename vendor/github.com/google/go-github/{v37 => v39}/github/orgs_projects.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/orgs_users_blocking.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/packages.go (52%) rename vendor/github.com/google/go-github/{v37 => v39}/github/projects.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/pulls.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/pulls_comments.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/pulls_reviewers.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/pulls_reviews.go (88%) rename vendor/github.com/google/go-github/{v37 => v39}/github/reactions.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos.go (94%) create mode 100644 vendor/github.com/google/go-github/v39/github/repos_autolinks.go rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_collaborators.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_comments.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_commits.go (96%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_community_health.go (71%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_contents.go (97%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_deployments.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_environments.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_forks.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_hooks.go (100%) create mode 100644 vendor/github.com/google/go-github/v39/github/repos_hooks_deliveries.go rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_invitations.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_keys.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_merging.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_pages.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_prereceive_hooks.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_projects.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_releases.go (91%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_stats.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_statuses.go (97%) rename vendor/github.com/google/go-github/{v37 => v39}/github/repos_traffic.go (100%) create mode 100644 vendor/github.com/google/go-github/v39/github/scim.go rename vendor/github.com/google/go-github/{v37 => v39}/github/search.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/strings.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/teams.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/teams_discussion_comments.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/teams_discussions.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/teams_members.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/timestamp.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/users.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/users_administration.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/users_blocking.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/users_emails.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/users_followers.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/users_gpg_keys.go (98%) rename vendor/github.com/google/go-github/{v37 => v39}/github/users_keys.go (100%) create mode 100644 vendor/github.com/google/go-github/v39/github/users_packages.go rename vendor/github.com/google/go-github/{v37 => v39}/github/users_projects.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/with_appengine.go (100%) rename vendor/github.com/google/go-github/{v37 => v39}/github/without_appengine.go (100%) diff --git a/go.mod b/go.mod index ce22ba2204..b8f84c62c1 100644 --- a/go.mod +++ b/go.mod @@ -53,8 +53,7 @@ require ( github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85 github.com/golang-jwt/jwt v3.2.2+incompatible github.com/golang/snappy v0.0.4 // indirect - github.com/google/go-github/v37 v37.0.0 - github.com/google/go-querystring v1.1.0 // indirect + github.com/google/go-github/v39 v39.2.0 github.com/google/uuid v1.2.0 github.com/gorilla/context v1.1.1 github.com/gorilla/feeds v1.1.1 diff --git a/go.sum b/go.sum index fcf4e9f9e1..321007050b 100644 --- a/go.sum +++ b/go.sum @@ -562,8 +562,8 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-github/v37 v37.0.0 h1:rCspN8/6kB1BAJWZfuafvHhyfIo5fkAulaP/3bOQ/tM= -github.com/google/go-github/v37 v37.0.0/go.mod h1:LM7in3NmXDrX58GbEHy7FtNLbI2JijX93RnMKvWG3m4= +github.com/google/go-github/v39 v39.2.0 h1:rNNM311XtPOz5rDdsJXAp2o8F67X9FnROXTvto3aSnQ= +github.com/google/go-github/v39 v39.2.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= diff --git a/modules/migrations/error.go b/modules/migrations/error.go index da8e7e0582..b90d1b6577 100644 --- a/modules/migrations/error.go +++ b/modules/migrations/error.go @@ -8,7 +8,7 @@ package migrations import ( "errors" - "github.com/google/go-github/v37/github" + "github.com/google/go-github/v39/github" ) var ( diff --git a/modules/migrations/github.go b/modules/migrations/github.go index 1a228c84a4..874cd05439 100644 --- a/modules/migrations/github.go +++ b/modules/migrations/github.go @@ -23,7 +23,7 @@ import ( "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/util" - "github.com/google/go-github/v37/github" + "github.com/google/go-github/v39/github" "golang.org/x/oauth2" ) diff --git a/vendor/github.com/google/go-github/v37/AUTHORS b/vendor/github.com/google/go-github/v39/AUTHORS similarity index 94% rename from vendor/github.com/google/go-github/v37/AUTHORS rename to vendor/github.com/google/go-github/v39/AUTHORS index f8b2328dbe..80bd26dd4f 100644 --- a/vendor/github.com/google/go-github/v37/AUTHORS +++ b/vendor/github.com/google/go-github/v39/AUTHORS @@ -26,6 +26,7 @@ Alex Bramley Alex Orr Alex Unger Alexander Harkness +Alexis Gauthiez Ali Farooq Allen Sun Amey Sakhadeo @@ -50,6 +51,7 @@ Arıl Bozoluk Asier Marruedo Austin Burdine Austin Dizzy +Azuka Okuleye Ben Batha Benjamen Keroack Beshr Kayali @@ -63,6 +65,7 @@ Brad Moylan Bradley Falzon Bradley McAllister Brandon Cook +Brett Logan Brian Egizi Bryan Boreham Cami Diez @@ -72,7 +75,9 @@ Carlos Tadeu Panato Junior chandresh-pancholi Charles Fenwick Elliott Charlie Yan +Chmouel Boudjnah Chris King +Chris Mc Chris Raborg Chris Roche Chris Schaefer @@ -89,6 +94,7 @@ Daniel Nilsson Daoq Dave Du Cros Dave Henderson +Dave Perrett Dave Protasowski David Deng David J. M. Karlsen @@ -97,6 +103,7 @@ David Ji David Lopez Reyes Davide Zipeto Dennis Webb +Derek Jobst Dhi Aurrahman Diego Lapiduz Dmitri Shuralyov @@ -114,6 +121,7 @@ Erick Fejta Erik Nobel erwinvaneyk Evan Elias +Fabian Holler Fabrice Felix Geisendörfer Filippo Valsorda @@ -140,15 +148,19 @@ haya14busa Huy Tr huydx i2bskn +Ikko Ashimine Ioannis Georgoulas Isao Jonas ishan upadhyay isqua Jacob Valdemar Jake Krammer +Jake White Jameel Haffejee James Cockbain +James Loh Jan Kosecki +Jan Švábík Javier Campanini Jef LeCompte Jens Rantil @@ -180,6 +192,7 @@ Katrina Owen Kautilya Tripathi Keita Urashima Kevin Burke +Kirill Konrad Malawski Kookheon Kwon Krzysztof Kowalczyk @@ -189,6 +202,7 @@ kyokomi Laurent Verdoïa Liam Galvin Lovro Mažgon +Luca Campese Lucas Alcantara Luke Evers Luke Kysow @@ -196,6 +210,7 @@ Luke Roberts Luke Young lynn [they] Maksim Zhylinski +Marc Binder Marcelo Carlos Mark Tareshawty Martin Holman @@ -204,6 +219,7 @@ Martins Sipenko Marwan Sulaiman Masayuki Izumi Mat Geist +Matin Rahmanian Matt Matt Brender Matt Gaunt @@ -215,6 +231,7 @@ Michael Tiller Michał Glapa Michelangelo Morrillo Mukundan Senthil +Munia Balayil Nadav Kaner Nathan VanBenschoten Navaneeth Suresh @@ -229,6 +246,7 @@ ns-cweber Ole Orhagen Oleg Kovalov Ondřej Kupka +Ori Talmor Pablo Pérez Schröder Palash Nigam Panagiotis Moustafellos @@ -265,11 +283,13 @@ Ricco Førgaard Rob Figueiredo Rohit Upadhyay Ronak Jain +Ross Gustafson Ruben Vereecken Russell Boley Ryan Leung Ryan Lower Ryo Nakao +Saaarah Safwan Olaimat Sahil Dua saisi @@ -332,4 +352,6 @@ Yannick Utard Yicheng Qin Yosuke Akatsuka Yumikiyo Osanai +Yusuke Kuoka Zach Latta +zhouhaibing089 \ No newline at end of file diff --git a/vendor/github.com/google/go-github/v37/LICENSE b/vendor/github.com/google/go-github/v39/LICENSE similarity index 100% rename from vendor/github.com/google/go-github/v37/LICENSE rename to vendor/github.com/google/go-github/v39/LICENSE diff --git a/vendor/github.com/google/go-github/v37/github/actions.go b/vendor/github.com/google/go-github/v39/github/actions.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/actions.go rename to vendor/github.com/google/go-github/v39/github/actions.go diff --git a/vendor/github.com/google/go-github/v37/github/actions_artifacts.go b/vendor/github.com/google/go-github/v39/github/actions_artifacts.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/actions_artifacts.go rename to vendor/github.com/google/go-github/v39/github/actions_artifacts.go diff --git a/vendor/github.com/google/go-github/v37/github/actions_runner_groups.go b/vendor/github.com/google/go-github/v39/github/actions_runner_groups.go similarity index 95% rename from vendor/github.com/google/go-github/v37/github/actions_runner_groups.go rename to vendor/github.com/google/go-github/v39/github/actions_runner_groups.go index 5772daaa75..2d6a15463e 100644 --- a/vendor/github.com/google/go-github/v37/github/actions_runner_groups.go +++ b/vendor/github.com/google/go-github/v39/github/actions_runner_groups.go @@ -36,12 +36,15 @@ type CreateRunnerGroupRequest struct { SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` // Runners represent a list of runner IDs to add to the runner group. Runners []int64 `json:"runners,omitempty"` + // If set to True, public repos can use this runner group + AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` } // UpdateRunnerGroupRequest represents a request to update a Runner group for an organization. type UpdateRunnerGroupRequest struct { - Name *string `json:"name,omitempty"` - Visibility *string `json:"visibility,omitempty"` + Name *string `json:"name,omitempty"` + Visibility *string `json:"visibility,omitempty"` + AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` } // SetRepoAccessRunnerGroupRequest represents a request to replace the list of repositories @@ -156,8 +159,13 @@ func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org // ListRepositoryAccessRunnerGroup lists the repositories with access to a self-hosted runner group configured in an organization. // // GitHub API docs: https://docs.github.com/en/rest/reference/actions#list-repository-access-to-a-self-hosted-runner-group-in-an-organization -func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64) (*ListRepositories, *Response, error) { +func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, opts *ListOptions) (*ListRepositories, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories", org, groupID) + 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 diff --git a/vendor/github.com/google/go-github/v37/github/actions_runners.go b/vendor/github.com/google/go-github/v39/github/actions_runners.go similarity index 84% rename from vendor/github.com/google/go-github/v37/github/actions_runners.go rename to vendor/github.com/google/go-github/v39/github/actions_runners.go index 5bdebb3193..f37e1aa419 100644 --- a/vendor/github.com/google/go-github/v37/github/actions_runners.go +++ b/vendor/github.com/google/go-github/v39/github/actions_runners.go @@ -264,6 +264,65 @@ func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string return repos, resp, nil } +// SetEnabledReposInOrg replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/actions#set-selected-repositories-enabled-for-github-actions-in-an-organization +func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) + + req, err := s.client.NewRequest("PUT", u, struct { + IDs []int64 `json:"selected_repository_ids"` + }{IDs: repositoryIDs}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddEnabledReposInOrg adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/actions#enable-a-selected-repository-for-github-actions-in-an-organization +func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) + + 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 +} + +// RemoveEnabledRepoInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/actions#disable-a-selected-repository-for-github-actions-in-an-organization +func (s *ActionsService) RemoveEnabledRepoInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) + + 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 +} + // GetOrganizationRunner gets a specific self-hosted runner for an organization using its runner ID. // // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#get-a-self-hosted-runner-for-an-organization diff --git a/vendor/github.com/google/go-github/v37/github/actions_secrets.go b/vendor/github.com/google/go-github/v39/github/actions_secrets.go similarity index 99% rename from vendor/github.com/google/go-github/v37/github/actions_secrets.go rename to vendor/github.com/google/go-github/v39/github/actions_secrets.go index 379eab81cb..5bfb22ac08 100644 --- a/vendor/github.com/google/go-github/v37/github/actions_secrets.go +++ b/vendor/github.com/google/go-github/v39/github/actions_secrets.go @@ -302,7 +302,7 @@ func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org, u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name) type repoIDs struct { - SelectedIDs SelectedRepoIDs `json:"selected_repository_ids,omitempty"` + SelectedIDs SelectedRepoIDs `json:"selected_repository_ids"` } req, err := s.client.NewRequest("PUT", u, repoIDs{SelectedIDs: ids}) diff --git a/vendor/github.com/google/go-github/v37/github/actions_workflow_jobs.go b/vendor/github.com/google/go-github/v39/github/actions_workflow_jobs.go similarity index 97% rename from vendor/github.com/google/go-github/v37/github/actions_workflow_jobs.go rename to vendor/github.com/google/go-github/v39/github/actions_workflow_jobs.go index 1102a756a5..86921baeb4 100644 --- a/vendor/github.com/google/go-github/v37/github/actions_workflow_jobs.go +++ b/vendor/github.com/google/go-github/v39/github/actions_workflow_jobs.go @@ -38,6 +38,8 @@ type WorkflowJob struct { Name *string `json:"name,omitempty"` Steps []*TaskStep `json:"steps,omitempty"` CheckRunURL *string `json:"check_run_url,omitempty"` + // Labels represents runner labels from the `runs-on:` key from a GitHub Actions workflow. + Labels []string `json:"labels,omitempty"` } // Jobs represents a slice of repository action workflow job. @@ -145,5 +147,4 @@ func (s *ActionsService) getWorkflowLogsFromURL(ctx context.Context, u string, f resp, err = s.getWorkflowLogsFromURL(ctx, u, false) } return resp, err - } diff --git a/vendor/github.com/google/go-github/v37/github/actions_workflow_runs.go b/vendor/github.com/google/go-github/v39/github/actions_workflow_runs.go similarity index 79% rename from vendor/github.com/google/go-github/v37/github/actions_workflow_runs.go rename to vendor/github.com/google/go-github/v39/github/actions_workflow_runs.go index 64274a3d03..3cd9df137a 100644 --- a/vendor/github.com/google/go-github/v37/github/actions_workflow_runs.go +++ b/vendor/github.com/google/go-github/v39/github/actions_workflow_runs.go @@ -14,31 +14,33 @@ import ( // WorkflowRun represents a repository action workflow run. type WorkflowRun struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - NodeID *string `json:"node_id,omitempty"` - HeadBranch *string `json:"head_branch,omitempty"` - HeadSHA *string `json:"head_sha,omitempty"` - RunNumber *int `json:"run_number,omitempty"` - Event *string `json:"event,omitempty"` - Status *string `json:"status,omitempty"` - Conclusion *string `json:"conclusion,omitempty"` - WorkflowID *int64 `json:"workflow_id,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - PullRequests []*PullRequest `json:"pull_requests,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - JobsURL *string `json:"jobs_url,omitempty"` - LogsURL *string `json:"logs_url,omitempty"` - CheckSuiteURL *string `json:"check_suite_url,omitempty"` - ArtifactsURL *string `json:"artifacts_url,omitempty"` - CancelURL *string `json:"cancel_url,omitempty"` - RerunURL *string `json:"rerun_url,omitempty"` - HeadCommit *HeadCommit `json:"head_commit,omitempty"` - WorkflowURL *string `json:"workflow_url,omitempty"` - Repository *Repository `json:"repository,omitempty"` - HeadRepository *Repository `json:"head_repository,omitempty"` + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + NodeID *string `json:"node_id,omitempty"` + HeadBranch *string `json:"head_branch,omitempty"` + HeadSHA *string `json:"head_sha,omitempty"` + RunNumber *int `json:"run_number,omitempty"` + Event *string `json:"event,omitempty"` + Status *string `json:"status,omitempty"` + Conclusion *string `json:"conclusion,omitempty"` + WorkflowID *int64 `json:"workflow_id,omitempty"` + CheckSuiteID *int64 `json:"check_suite_id,omitempty"` + CheckSuiteNodeID *string `json:"check_suite_node_id,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + PullRequests []*PullRequest `json:"pull_requests,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + JobsURL *string `json:"jobs_url,omitempty"` + LogsURL *string `json:"logs_url,omitempty"` + CheckSuiteURL *string `json:"check_suite_url,omitempty"` + ArtifactsURL *string `json:"artifacts_url,omitempty"` + CancelURL *string `json:"cancel_url,omitempty"` + RerunURL *string `json:"rerun_url,omitempty"` + HeadCommit *HeadCommit `json:"head_commit,omitempty"` + WorkflowURL *string `json:"workflow_url,omitempty"` + Repository *Repository `json:"repository,omitempty"` + HeadRepository *Repository `json:"head_repository,omitempty"` } // WorkflowRuns represents a slice of repository action workflow run. @@ -49,10 +51,11 @@ type WorkflowRuns struct { // ListWorkflowRunsOptions specifies optional parameters to ListWorkflowRuns. type ListWorkflowRunsOptions struct { - Actor string `url:"actor,omitempty"` - Branch string `url:"branch,omitempty"` - Event string `url:"event,omitempty"` - Status string `url:"status,omitempty"` + Actor string `url:"actor,omitempty"` + Branch string `url:"branch,omitempty"` + Event string `url:"event,omitempty"` + Status string `url:"status,omitempty"` + Created string `url:"created,omitempty"` ListOptions } diff --git a/vendor/github.com/google/go-github/v37/github/actions_workflows.go b/vendor/github.com/google/go-github/v39/github/actions_workflows.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/actions_workflows.go rename to vendor/github.com/google/go-github/v39/github/actions_workflows.go diff --git a/vendor/github.com/google/go-github/v37/github/activity.go b/vendor/github.com/google/go-github/v39/github/activity.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/activity.go rename to vendor/github.com/google/go-github/v39/github/activity.go diff --git a/vendor/github.com/google/go-github/v37/github/activity_events.go b/vendor/github.com/google/go-github/v39/github/activity_events.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/activity_events.go rename to vendor/github.com/google/go-github/v39/github/activity_events.go diff --git a/vendor/github.com/google/go-github/v37/github/activity_notifications.go b/vendor/github.com/google/go-github/v39/github/activity_notifications.go similarity index 99% rename from vendor/github.com/google/go-github/v37/github/activity_notifications.go rename to vendor/github.com/google/go-github/v39/github/activity_notifications.go index 9b6fbe2b58..009cc5e32a 100644 --- a/vendor/github.com/google/go-github/v37/github/activity_notifications.go +++ b/vendor/github.com/google/go-github/v39/github/activity_notifications.go @@ -51,7 +51,7 @@ type NotificationListOptions struct { // // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/#list-notifications-for-the-authenticated-user func (s *ActivityService) ListNotifications(ctx context.Context, opts *NotificationListOptions) ([]*Notification, *Response, error) { - u := fmt.Sprintf("notifications") + u := "notifications" u, err := addOptions(u, opts) if err != nil { return nil, nil, err diff --git a/vendor/github.com/google/go-github/v37/github/activity_star.go b/vendor/github.com/google/go-github/v39/github/activity_star.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/activity_star.go rename to vendor/github.com/google/go-github/v39/github/activity_star.go diff --git a/vendor/github.com/google/go-github/v37/github/activity_watching.go b/vendor/github.com/google/go-github/v39/github/activity_watching.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/activity_watching.go rename to vendor/github.com/google/go-github/v39/github/activity_watching.go diff --git a/vendor/github.com/google/go-github/v37/github/admin.go b/vendor/github.com/google/go-github/v39/github/admin.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/admin.go rename to vendor/github.com/google/go-github/v39/github/admin.go diff --git a/vendor/github.com/google/go-github/v37/github/admin_orgs.go b/vendor/github.com/google/go-github/v39/github/admin_orgs.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/admin_orgs.go rename to vendor/github.com/google/go-github/v39/github/admin_orgs.go diff --git a/vendor/github.com/google/go-github/v37/github/admin_stats.go b/vendor/github.com/google/go-github/v39/github/admin_stats.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/admin_stats.go rename to vendor/github.com/google/go-github/v39/github/admin_stats.go diff --git a/vendor/github.com/google/go-github/v37/github/admin_users.go b/vendor/github.com/google/go-github/v39/github/admin_users.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/admin_users.go rename to vendor/github.com/google/go-github/v39/github/admin_users.go diff --git a/vendor/github.com/google/go-github/v37/github/apps.go b/vendor/github.com/google/go-github/v39/github/apps.go similarity index 98% rename from vendor/github.com/google/go-github/v37/github/apps.go rename to vendor/github.com/google/go-github/v39/github/apps.go index 8b850d9e5d..3823a12196 100644 --- a/vendor/github.com/google/go-github/v37/github/apps.go +++ b/vendor/github.com/google/go-github/v39/github/apps.go @@ -47,6 +47,10 @@ type InstallationTokenOptions struct { // Providing repository IDs restricts the access of an installation token to specific repositories. RepositoryIDs []int64 `json:"repository_ids,omitempty"` + // 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"` diff --git a/vendor/github.com/google/go-github/v39/github/apps_hooks.go b/vendor/github.com/google/go-github/v39/github/apps_hooks.go new file mode 100644 index 0000000000..ed8396f442 --- /dev/null +++ b/vendor/github.com/google/go-github/v39/github/apps_hooks.go @@ -0,0 +1,48 @@ +// Copyright 2021 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" +) + +// GetHookConfig returns the webhook configuration for a GitHub App. +// The underlying transport must be authenticated as an app. +// +// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#get-a-webhook-configuration-for-an-app +func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response, error) { + req, err := s.client.NewRequest("GET", "app/hook/config", nil) + if err != nil { + return nil, nil, err + } + + config := new(HookConfig) + resp, err := s.client.Do(ctx, req, &config) + if err != nil { + return nil, resp, err + } + + return config, resp, nil +} + +// UpdateHookConfig updates the webhook configuration for a GitHub App. +// The underlying transport must be authenticated as an app. +// +// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/apps#update-a-webhook-configuration-for-an-app +func (s *AppsService) UpdateHookConfig(ctx context.Context, config *HookConfig) (*HookConfig, *Response, error) { + req, err := s.client.NewRequest("PATCH", "app/hook/config", config) + if err != nil { + return nil, nil, err + } + + c := new(HookConfig) + resp, err := s.client.Do(ctx, req, c) + if err != nil { + return nil, resp, err + } + + return c, resp, nil +} diff --git a/vendor/github.com/google/go-github/v37/github/apps_installation.go b/vendor/github.com/google/go-github/v39/github/apps_installation.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/apps_installation.go rename to vendor/github.com/google/go-github/v39/github/apps_installation.go diff --git a/vendor/github.com/google/go-github/v37/github/apps_manifest.go b/vendor/github.com/google/go-github/v39/github/apps_manifest.go similarity index 96% rename from vendor/github.com/google/go-github/v37/github/apps_manifest.go rename to vendor/github.com/google/go-github/v39/github/apps_manifest.go index defd6c0a0b..164f493999 100644 --- a/vendor/github.com/google/go-github/v37/github/apps_manifest.go +++ b/vendor/github.com/google/go-github/v39/github/apps_manifest.go @@ -13,6 +13,7 @@ import ( // AppConfig describes the configuration of a GitHub App. type AppConfig struct { ID *int64 `json:"id,omitempty"` + Slug *string `json:"slug,omitempty"` NodeID *string `json:"node_id,omitempty"` Owner *User `json:"owner,omitempty"` Name *string `json:"name,omitempty"` diff --git a/vendor/github.com/google/go-github/v37/github/apps_marketplace.go b/vendor/github.com/google/go-github/v39/github/apps_marketplace.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/apps_marketplace.go rename to vendor/github.com/google/go-github/v39/github/apps_marketplace.go diff --git a/vendor/github.com/google/go-github/v37/github/authorizations.go b/vendor/github.com/google/go-github/v39/github/authorizations.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/authorizations.go rename to vendor/github.com/google/go-github/v39/github/authorizations.go diff --git a/vendor/github.com/google/go-github/v37/github/billing.go b/vendor/github.com/google/go-github/v39/github/billing.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/billing.go rename to vendor/github.com/google/go-github/v39/github/billing.go diff --git a/vendor/github.com/google/go-github/v37/github/checks.go b/vendor/github.com/google/go-github/v39/github/checks.go similarity index 99% rename from vendor/github.com/google/go-github/v37/github/checks.go rename to vendor/github.com/google/go-github/v39/github/checks.go index cb8b847f38..07afb7c439 100644 --- a/vendor/github.com/google/go-github/v37/github/checks.go +++ b/vendor/github.com/google/go-github/v39/github/checks.go @@ -78,6 +78,8 @@ type CheckSuite struct { AfterSHA *string `json:"after,omitempty"` Status *string `json:"status,omitempty"` Conclusion *string `json:"conclusion,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` App *App `json:"app,omitempty"` Repository *Repository `json:"repository,omitempty"` PullRequests []*PullRequest `json:"pull_requests,omitempty"` diff --git a/vendor/github.com/google/go-github/v37/github/code-scanning.go b/vendor/github.com/google/go-github/v39/github/code-scanning.go similarity index 55% rename from vendor/github.com/google/go-github/v37/github/code-scanning.go rename to vendor/github.com/google/go-github/v39/github/code-scanning.go index 8602c44632..50264a0c3b 100644 --- a/vendor/github.com/google/go-github/v37/github/code-scanning.go +++ b/vendor/github.com/google/go-github/v39/github/code-scanning.go @@ -18,9 +18,45 @@ import ( // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/code-scanning/ type CodeScanningService service +// Rule represents the complete details of GitHub Code Scanning alert type. +type Rule struct { + ID *string `json:"id,omitempty"` + Severity *string `json:"severity,omitempty"` + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + SecuritySeverityLevel *string `json:"security_severity_level,omitempty"` + FullDescription *string `json:"full_description,omitempty"` + Tags []string `json:"tags,omitempty"` + Help *string `json:"help,omitempty"` +} + +// Location represents the exact location of the GitHub Code Scanning Alert in the scanned project. +type Location struct { + Path *string `json:"path,omitempty"` + StartLine *int `json:"start_line,omitempty"` + EndLine *int `json:"end_line,omitempty"` + StartColumn *int `json:"start_column,omitempty"` + EndColumn *int `json:"end_column,omitempty"` +} + +// Message is a part of MostRecentInstance struct which provides the appropriate message when any action is performed on the analysis object. +type Message struct { + Text *string `json:"text,omitempty"` +} + +// MostRecentInstance provides details of the most recent instance of this alert for the default branch or for the specified Git reference. +type MostRecentInstance struct { + Ref *string `json:"ref,omitempty"` + AnalysisKey *string `json:"analysis_key,omitempty"` + Environment *string `json:"environment,omitempty"` + State *string `json:"state,omitempty"` + CommitSHA *string `json:"commit_sha,omitempty"` + Message *Message `json:"message,omitempty"` + Location *Location `json:"location,omitempty"` + Classifications []string `json:"classifications,omitempty"` +} + // Tool represents the tool used to generate a GitHub Code Scanning Alert. -// -// GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#list-code-scanning-alerts-for-a-repository type Tool struct { Name *string `json:"name,omitempty"` GUID *string `json:"guid,omitempty"` @@ -31,16 +67,22 @@ type Tool struct { // // GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#list-code-scanning-alerts-for-a-repository type Alert struct { - RuleID *string `json:"rule_id,omitempty"` - RuleSeverity *string `json:"rule_severity,omitempty"` - RuleDescription *string `json:"rule_description,omitempty"` - Tool *Tool `json:"tool,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - Open *bool `json:"open,omitempty"` - ClosedBy *User `json:"closed_by,omitempty"` - ClosedAt *Timestamp `json:"closed_at,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` + RuleID *string `json:"rule_id,omitempty"` + RuleSeverity *string `json:"rule_severity,omitempty"` + RuleDescription *string `json:"rule_description,omitempty"` + Rule *Rule `json:"rule,omitempty"` + Tool *Tool `json:"tool,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + State *string `json:"state,omitempty"` + ClosedBy *User `json:"closed_by,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + MostRecentInstance *MostRecentInstance `json:"most_recent_instance,omitempty"` + DismissedBy *User `json:"dismissed_by,omitempty"` + DismissedAt *Timestamp `json:"dismissed_at,omitempty"` + DismissedReason *string `json:"dismissed_reason,omitempty"` + InstancesURL *string `json:"instances_url,omitempty"` } // ID returns the ID associated with an alert. It is the number at the end of the security alert's URL. @@ -73,6 +115,8 @@ type AlertListOptions struct { // Return code scanning alerts for a specific branch reference. The ref must be formatted as heads/. Ref string `url:"ref,omitempty"` + + ListOptions } // ListAlertsForRepo lists code scanning alerts for a repository. diff --git a/vendor/github.com/google/go-github/v37/github/doc.go b/vendor/github.com/google/go-github/v39/github/doc.go similarity index 88% rename from vendor/github.com/google/go-github/v37/github/doc.go rename to vendor/github.com/google/go-github/v39/github/doc.go index bd2e3ea063..87eda1dec7 100644 --- a/vendor/github.com/google/go-github/v37/github/doc.go +++ b/vendor/github.com/google/go-github/v39/github/doc.go @@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v37/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) + import "github.com/google/go-github/v39/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 @@ -73,6 +73,10 @@ BasicAuthTransport. GitHub Apps authentication can be provided by the https://github.com/bradleyfalzon/ghinstallation package. +It supports both authentication as an installation, using an installation access token, +and as an app, using a JWT. + +To authenticate as an installation: import "github.com/bradleyfalzon/ghinstallation" @@ -89,6 +93,23 @@ https://github.com/bradleyfalzon/ghinstallation package. // Use client... } +To authenticate as an app, using a JWT: + + import "github.com/bradleyfalzon/ghinstallation" + + func main() { + // Wrap the shared transport for use with the application ID 1. + atr, err := ghinstallation.NewAppsTransportKeyFromFile(http.DefaultTransport, 1, "2016-10-19.private-key.pem") + if err != nil { + // Handle error. + } + + // Use app transport with client + client := github.NewClient(&http.Client{Transport: atr}) + + // Use client... + } + Rate Limiting GitHub imposes a rate limit on all API clients. Unauthenticated clients are @@ -112,7 +133,7 @@ To detect an API rate limit error, you can check if its type is *github.RateLimi } Learn more about GitHub rate limiting at -https://docs.github.com/en/free-pro-team@latest/rest/reference/#rate-limiting. +https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#rate-limiting. Accepted Status @@ -138,7 +159,7 @@ instead designed to work with a caching http.Transport. We recommend using https://github.com/gregjones/httpcache for that. Learn more about GitHub conditional requests at -https://docs.github.com/en/free-pro-team@latest/rest/reference/#conditional-requests. +https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#conditional-requests. Creating and Updating Resources diff --git a/vendor/github.com/google/go-github/v37/github/enterprise.go b/vendor/github.com/google/go-github/v39/github/enterprise.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/enterprise.go rename to vendor/github.com/google/go-github/v39/github/enterprise.go diff --git a/vendor/github.com/google/go-github/v37/github/enterprise_actions_runners.go b/vendor/github.com/google/go-github/v39/github/enterprise_actions_runners.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/enterprise_actions_runners.go rename to vendor/github.com/google/go-github/v39/github/enterprise_actions_runners.go diff --git a/vendor/github.com/google/go-github/v37/github/enterprise_audit_log.go b/vendor/github.com/google/go-github/v39/github/enterprise_audit_log.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/enterprise_audit_log.go rename to vendor/github.com/google/go-github/v39/github/enterprise_audit_log.go diff --git a/vendor/github.com/google/go-github/v37/github/event.go b/vendor/github.com/google/go-github/v39/github/event.go similarity index 96% rename from vendor/github.com/google/go-github/v37/github/event.go rename to vendor/github.com/google/go-github/v39/github/event.go index 4b87142a8c..9241d0286d 100644 --- a/vendor/github.com/google/go-github/v37/github/event.go +++ b/vendor/github.com/google/go-github/v39/github/event.go @@ -30,6 +30,8 @@ func (e Event) String() string { // a value of the corresponding struct type will be returned. func (e *Event) ParsePayload() (payload interface{}, err error) { switch *e.Type { + case "BranchProtectionRuleEvent": + payload = &BranchProtectionRuleEvent{} case "CheckRunEvent": payload = &CheckRunEvent{} case "CheckSuiteEvent": @@ -124,6 +126,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) { payload = &WatchEvent{} case "WorkflowDispatchEvent": payload = &WorkflowDispatchEvent{} + case "WorkflowJobEvent": + payload = &WorkflowJobEvent{} case "WorkflowRunEvent": payload = &WorkflowRunEvent{} } diff --git a/vendor/github.com/google/go-github/v37/github/event_types.go b/vendor/github.com/google/go-github/v39/github/event_types.go similarity index 93% rename from vendor/github.com/google/go-github/v37/github/event_types.go rename to vendor/github.com/google/go-github/v39/github/event_types.go index f99a1296a0..5c81115877 100644 --- a/vendor/github.com/google/go-github/v37/github/event_types.go +++ b/vendor/github.com/google/go-github/v39/github/event_types.go @@ -15,6 +15,19 @@ type RequestedAction struct { Identifier string `json:"identifier"` // The integrator reference of the action requested by the user. } +// BranchProtectionRuleEvent triggered when a check suite is "created", "edited", or "deleted". +// The Webhook event name is "branch_protection_rule". +// +// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch_protection_rule +type BranchProtectionRuleEvent struct { + Action *string `json:"action,omitempty"` + Rule *BranchProtectionRule `json:"rule,omitempty"` + Changes *ProtectionChanges `json:"changes,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` +} + // CheckRunEvent is triggered when a check run is "created", "completed", or "rerequested". // The Webhook event name is "check_run". // @@ -130,6 +143,9 @@ type DeployKeyEvent struct { // The deploy key resource. Key *Key `json:"key,omitempty"` + + // The following fields are only populated by Webhook events. + Installation *Installation `json:"installation,omitempty"` } // DeploymentEvent represents a deployment. @@ -186,7 +202,8 @@ type GitHubAppAuthorizationEvent struct { Action *string `json:"action,omitempty"` // The following fields are only populated by Webhook events. - Sender *User `json:"sender,omitempty"` + Sender *User `json:"sender,omitempty"` + Installation *Installation `json:"installation,omitempty"` } // Page represents a single Wiki page. @@ -367,6 +384,10 @@ type IssueCommentEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Organization *Organization `json:"organization,omitempty"` } // IssuesEvent is triggered when an issue is opened, edited, deleted, transferred, @@ -478,6 +499,9 @@ type MetaEvent struct { // This will contain different keys based on the type of webhook it is: repository, // organization, business, app, or GitHub Marketplace. Hook *Hook `json:"hook,omitempty"` + + // The following fields are only populated by Webhook events. + Installation *Installation `json:"installation,omitempty"` } // MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted. @@ -551,6 +575,9 @@ type PackageEvent struct { Repo *Repository `json:"repository,omitempty"` Org *Organization `json:"organization,omitempty"` Sender *User `json:"sender,omitempty"` + + // The following fields are only populated by Webhook events. + Installation *Installation `json:"installation,omitempty"` } // PageBuildEvent represents an attempted build of a GitHub Pages site, whether @@ -796,6 +823,10 @@ type PushEvent struct { Pusher *User `json:"pusher,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Organization *Organization `json:"organization,omitempty"` } func (p PushEvent) String() string { @@ -939,6 +970,9 @@ type RepositoryVulnerabilityAlertEvent struct { //The repository of the vulnerable dependency. Repository *Repository `json:"repository,omitempty"` + + // The following fields are only populated by Webhook events. + Installation *Installation `json:"installation,omitempty"` } // RepositoryVulnerabilityAlert represents a repository security alert. @@ -969,9 +1003,10 @@ type StarEvent struct { StarredAt *Timestamp `json:"starred_at,omitempty"` // The following fields are only populated by Webhook events. - Org *Organization `json:"organization,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` + Org *Organization `json:"organization,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Sender *User `json:"sender,omitempty"` + Installation *Installation `json:"installation,omitempty"` } // StatusEvent is triggered when the status of a Git commit changes. @@ -1049,6 +1084,9 @@ type UserEvent struct { Action *string `json:"action,omitempty"` Enterprise *Enterprise `json:"enterprise,omitempty"` Sender *User `json:"sender,omitempty"` + + // The following fields are only populated by Webhook events. + Installation *Installation `json:"installation,omitempty"` } // WatchEvent is related to starring a repository, not watching. See this API @@ -1078,9 +1116,28 @@ type WorkflowDispatchEvent struct { Workflow *string `json:"workflow,omitempty"` // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` + Installation *Installation `json:"installation,omitempty"` +} + +// WorkflowJobEvent is triggered when a job is queued, started or completed. +// +// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job +type WorkflowJobEvent struct { + WorkflowJob *WorkflowJob `json:"workflow_job,omitempty"` + + Action *string `json:"action,omitempty"` + + // The following fields are only populated by Webhook events. + + // Org is not nil when the webhook is configured for an organization or the event + // occurs from activity in a repository owned by an organization. + Org *Organization `json:"organization,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Sender *User `json:"sender,omitempty"` + Installation *Installation `json:"installation,omitempty"` } // WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed. @@ -1092,7 +1149,8 @@ type WorkflowRunEvent struct { WorkflowRun *WorkflowRun `json:"workflow_run,omitempty"` // The following fields are only populated by Webhook events. - Org *Organization `json:"organization,omitempty"` - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` + Org *Organization `json:"organization,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Sender *User `json:"sender,omitempty"` + Installation *Installation `json:"installation,omitempty"` } diff --git a/vendor/github.com/google/go-github/v37/github/gists.go b/vendor/github.com/google/go-github/v39/github/gists.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/gists.go rename to vendor/github.com/google/go-github/v39/github/gists.go diff --git a/vendor/github.com/google/go-github/v37/github/gists_comments.go b/vendor/github.com/google/go-github/v39/github/gists_comments.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/gists_comments.go rename to vendor/github.com/google/go-github/v39/github/gists_comments.go diff --git a/vendor/github.com/google/go-github/v37/github/git.go b/vendor/github.com/google/go-github/v39/github/git.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/git.go rename to vendor/github.com/google/go-github/v39/github/git.go diff --git a/vendor/github.com/google/go-github/v37/github/git_blobs.go b/vendor/github.com/google/go-github/v39/github/git_blobs.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/git_blobs.go rename to vendor/github.com/google/go-github/v39/github/git_blobs.go diff --git a/vendor/github.com/google/go-github/v37/github/git_commits.go b/vendor/github.com/google/go-github/v39/github/git_commits.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/git_commits.go rename to vendor/github.com/google/go-github/v39/github/git_commits.go diff --git a/vendor/github.com/google/go-github/v37/github/git_refs.go b/vendor/github.com/google/go-github/v39/github/git_refs.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/git_refs.go rename to vendor/github.com/google/go-github/v39/github/git_refs.go diff --git a/vendor/github.com/google/go-github/v37/github/git_tags.go b/vendor/github.com/google/go-github/v39/github/git_tags.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/git_tags.go rename to vendor/github.com/google/go-github/v39/github/git_tags.go diff --git a/vendor/github.com/google/go-github/v37/github/git_trees.go b/vendor/github.com/google/go-github/v39/github/git_trees.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/git_trees.go rename to vendor/github.com/google/go-github/v39/github/git_trees.go diff --git a/vendor/github.com/google/go-github/v37/github/github-accessors.go b/vendor/github.com/google/go-github/v39/github/github-accessors.go similarity index 93% rename from vendor/github.com/google/go-github/v37/github/github-accessors.go rename to vendor/github.com/google/go-github/v39/github/github-accessors.go index 46efcc9c42..12dc2ca6a6 100644 --- a/vendor/github.com/google/go-github/v37/github/github-accessors.go +++ b/vendor/github.com/google/go-github/v39/github/github-accessors.go @@ -172,6 +172,30 @@ func (a *Alert) GetCreatedAt() Timestamp { return *a.CreatedAt } +// GetDismissedAt returns the DismissedAt field if it's non-nil, zero value otherwise. +func (a *Alert) GetDismissedAt() Timestamp { + if a == nil || a.DismissedAt == nil { + return Timestamp{} + } + return *a.DismissedAt +} + +// GetDismissedBy returns the DismissedBy field. +func (a *Alert) GetDismissedBy() *User { + if a == nil { + return nil + } + return a.DismissedBy +} + +// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. +func (a *Alert) GetDismissedReason() string { + if a == nil || a.DismissedReason == nil { + return "" + } + return *a.DismissedReason +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (a *Alert) GetHTMLURL() string { if a == nil || a.HTMLURL == nil { @@ -180,12 +204,28 @@ func (a *Alert) GetHTMLURL() string { return *a.HTMLURL } -// GetOpen returns the Open field if it's non-nil, zero value otherwise. -func (a *Alert) GetOpen() bool { - if a == nil || a.Open == nil { - return false +// GetInstancesURL returns the InstancesURL field if it's non-nil, zero value otherwise. +func (a *Alert) GetInstancesURL() string { + if a == nil || a.InstancesURL == nil { + return "" } - return *a.Open + return *a.InstancesURL +} + +// GetMostRecentInstance returns the MostRecentInstance field. +func (a *Alert) GetMostRecentInstance() *MostRecentInstance { + if a == nil { + return nil + } + return a.MostRecentInstance +} + +// GetRule returns the Rule field. +func (a *Alert) GetRule() *Rule { + if a == nil { + return nil + } + return a.Rule } // GetRuleDescription returns the RuleDescription field if it's non-nil, zero value otherwise. @@ -212,6 +252,14 @@ func (a *Alert) GetRuleSeverity() string { return *a.RuleSeverity } +// GetState returns the State field if it's non-nil, zero value otherwise. +func (a *Alert) GetState() string { + if a == nil || a.State == nil { + return "" + } + return *a.State +} + // GetTool returns the Tool field. func (a *Alert) GetTool() *Tool { if a == nil { @@ -412,6 +460,14 @@ func (a *AppConfig) GetPEM() string { return *a.PEM } +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetSlug() string { + if a == nil || a.Slug == nil { + return "" + } + return *a.Slug +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (a *AppConfig) GetUpdatedAt() Timestamp { if a == nil || a.UpdatedAt == nil { @@ -1132,6 +1188,54 @@ func (a *AuthorizationUpdateRequest) GetNoteURL() string { return *a.NoteURL } +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (a *AuthorizedActorsOnly) GetFrom() bool { + if a == nil || a.From == nil { + return false + } + return *a.From +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *Autolink) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetKeyPrefix returns the KeyPrefix field if it's non-nil, zero value otherwise. +func (a *Autolink) GetKeyPrefix() string { + if a == nil || a.KeyPrefix == nil { + return "" + } + return *a.KeyPrefix +} + +// GetURLTemplate returns the URLTemplate field if it's non-nil, zero value otherwise. +func (a *Autolink) GetURLTemplate() string { + if a == nil || a.URLTemplate == nil { + return "" + } + return *a.URLTemplate +} + +// GetKeyPrefix returns the KeyPrefix field if it's non-nil, zero value otherwise. +func (a *AutolinkOptions) GetKeyPrefix() string { + if a == nil || a.KeyPrefix == nil { + return "" + } + return *a.KeyPrefix +} + +// GetURLTemplate returns the URLTemplate field if it's non-nil, zero value otherwise. +func (a *AutolinkOptions) GetURLTemplate() string { + if a == nil || a.URLTemplate == nil { + return "" + } + return *a.URLTemplate +} + // GetAppID returns the AppID field if it's non-nil, zero value otherwise. func (a *AutoTriggerCheck) GetAppID() int64 { if a == nil || a.AppID == nil { @@ -1268,6 +1372,230 @@ func (b *BranchPolicy) GetProtectedBranches() bool { return *b.ProtectedBranches } +// GetAdminEnforced returns the AdminEnforced field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAdminEnforced() bool { + if b == nil || b.AdminEnforced == nil { + return false + } + return *b.AdminEnforced +} + +// GetAllowDeletionsEnforcementLevel returns the AllowDeletionsEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAllowDeletionsEnforcementLevel() string { + if b == nil || b.AllowDeletionsEnforcementLevel == nil { + return "" + } + return *b.AllowDeletionsEnforcementLevel +} + +// GetAllowForcePushesEnforcementLevel returns the AllowForcePushesEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAllowForcePushesEnforcementLevel() string { + if b == nil || b.AllowForcePushesEnforcementLevel == nil { + return "" + } + return *b.AllowForcePushesEnforcementLevel +} + +// GetAuthorizedActorsOnly returns the AuthorizedActorsOnly field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAuthorizedActorsOnly() bool { + if b == nil || b.AuthorizedActorsOnly == nil { + return false + } + return *b.AuthorizedActorsOnly +} + +// GetAuthorizedDismissalActorsOnly returns the AuthorizedDismissalActorsOnly field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAuthorizedDismissalActorsOnly() bool { + if b == nil || b.AuthorizedDismissalActorsOnly == nil { + return false + } + return *b.AuthorizedDismissalActorsOnly +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetCreatedAt() Timestamp { + if b == nil || b.CreatedAt == nil { + return Timestamp{} + } + return *b.CreatedAt +} + +// GetDismissStaleReviewsOnPush returns the DismissStaleReviewsOnPush field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetDismissStaleReviewsOnPush() bool { + if b == nil || b.DismissStaleReviewsOnPush == nil { + return false + } + return *b.DismissStaleReviewsOnPush +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetID() int64 { + if b == nil || b.ID == nil { + return 0 + } + return *b.ID +} + +// GetIgnoreApprovalsFromContributors returns the IgnoreApprovalsFromContributors field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetIgnoreApprovalsFromContributors() bool { + if b == nil || b.IgnoreApprovalsFromContributors == nil { + return false + } + return *b.IgnoreApprovalsFromContributors +} + +// GetLinearHistoryRequirementEnforcementLevel returns the LinearHistoryRequirementEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetLinearHistoryRequirementEnforcementLevel() string { + if b == nil || b.LinearHistoryRequirementEnforcementLevel == nil { + return "" + } + return *b.LinearHistoryRequirementEnforcementLevel +} + +// GetMergeQueueEnforcementLevel returns the MergeQueueEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetMergeQueueEnforcementLevel() string { + if b == nil || b.MergeQueueEnforcementLevel == nil { + return "" + } + return *b.MergeQueueEnforcementLevel +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetName() string { + if b == nil || b.Name == nil { + return "" + } + return *b.Name +} + +// GetPullRequestReviewsEnforcementLevel returns the PullRequestReviewsEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetPullRequestReviewsEnforcementLevel() string { + if b == nil || b.PullRequestReviewsEnforcementLevel == nil { + return "" + } + return *b.PullRequestReviewsEnforcementLevel +} + +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRepositoryID() int64 { + if b == nil || b.RepositoryID == nil { + return 0 + } + return *b.RepositoryID +} + +// GetRequireCodeOwnerReview returns the RequireCodeOwnerReview field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequireCodeOwnerReview() bool { + if b == nil || b.RequireCodeOwnerReview == nil { + return false + } + return *b.RequireCodeOwnerReview +} + +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequiredApprovingReviewCount() int { + if b == nil || b.RequiredApprovingReviewCount == nil { + return 0 + } + return *b.RequiredApprovingReviewCount +} + +// GetRequiredConversationResolutionLevel returns the RequiredConversationResolutionLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequiredConversationResolutionLevel() string { + if b == nil || b.RequiredConversationResolutionLevel == nil { + return "" + } + return *b.RequiredConversationResolutionLevel +} + +// GetRequiredDeploymentsEnforcementLevel returns the RequiredDeploymentsEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequiredDeploymentsEnforcementLevel() string { + if b == nil || b.RequiredDeploymentsEnforcementLevel == nil { + return "" + } + return *b.RequiredDeploymentsEnforcementLevel +} + +// GetRequiredStatusChecksEnforcementLevel returns the RequiredStatusChecksEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequiredStatusChecksEnforcementLevel() string { + if b == nil || b.RequiredStatusChecksEnforcementLevel == nil { + return "" + } + return *b.RequiredStatusChecksEnforcementLevel +} + +// GetSignatureRequirementEnforcementLevel returns the SignatureRequirementEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetSignatureRequirementEnforcementLevel() string { + if b == nil || b.SignatureRequirementEnforcementLevel == nil { + return "" + } + return *b.SignatureRequirementEnforcementLevel +} + +// GetStrictRequiredStatusChecksPolicy returns the StrictRequiredStatusChecksPolicy field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetStrictRequiredStatusChecksPolicy() bool { + if b == nil || b.StrictRequiredStatusChecksPolicy == nil { + return false + } + return *b.StrictRequiredStatusChecksPolicy +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetUpdatedAt() Timestamp { + if b == nil || b.UpdatedAt == nil { + return Timestamp{} + } + return *b.UpdatedAt +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRuleEvent) GetAction() string { + if b == nil || b.Action == nil { + return "" + } + return *b.Action +} + +// GetChanges returns the Changes field. +func (b *BranchProtectionRuleEvent) GetChanges() *ProtectionChanges { + if b == nil { + return nil + } + return b.Changes +} + +// GetOrg returns the Org field. +func (b *BranchProtectionRuleEvent) GetOrg() *Organization { + if b == nil { + return nil + } + return b.Org +} + +// GetRepo returns the Repo field. +func (b *BranchProtectionRuleEvent) GetRepo() *Repository { + if b == nil { + return nil + } + return b.Repo +} + +// GetRule returns the Rule field. +func (b *BranchProtectionRuleEvent) GetRule() *BranchProtectionRule { + if b == nil { + return nil + } + return b.Rule +} + +// GetSender returns the Sender field. +func (b *BranchProtectionRuleEvent) GetSender() *User { + if b == nil { + return nil + } + return b.Sender +} + // GetApp returns the App field. func (c *CheckRun) GetApp() *App { if c == nil { @@ -1612,6 +1940,14 @@ func (c *CheckSuite) GetConclusion() string { return *c.Conclusion } +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} + } + return *c.CreatedAt +} + // GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. func (c *CheckSuite) GetHeadBranch() string { if c == nil || c.HeadBranch == nil { @@ -1668,6 +2004,14 @@ func (c *CheckSuite) GetStatus() string { return *c.Status } +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} + } + return *c.UpdatedAt +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (c *CheckSuite) GetURL() string { if c == nil || c.URL == nil { @@ -2436,6 +2780,14 @@ func (c *CommunityHealthFiles) GetCodeOfConduct() *Metric { return c.CodeOfConduct } +// GetCodeOfConductFile returns the CodeOfConductFile field. +func (c *CommunityHealthFiles) GetCodeOfConductFile() *Metric { + if c == nil { + return nil + } + return c.CodeOfConductFile +} + // GetContributing returns the Contributing field. func (c *CommunityHealthFiles) GetContributing() *Metric { if c == nil { @@ -2476,6 +2828,30 @@ func (c *CommunityHealthFiles) GetReadme() *Metric { return c.Readme } +// GetContentReportsEnabled returns the ContentReportsEnabled field if it's non-nil, zero value otherwise. +func (c *CommunityHealthMetrics) GetContentReportsEnabled() bool { + if c == nil || c.ContentReportsEnabled == nil { + return false + } + return *c.ContentReportsEnabled +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CommunityHealthMetrics) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetDocumentation returns the Documentation field if it's non-nil, zero value otherwise. +func (c *CommunityHealthMetrics) GetDocumentation() string { + if c == nil || c.Documentation == nil { + return "" + } + return *c.Documentation +} + // GetFiles returns the Files field. func (c *CommunityHealthMetrics) GetFiles() *CommunityHealthFiles { if c == nil { @@ -2900,6 +3276,14 @@ func (c *CreateOrgInvitationOptions) GetRole() string { return *c.Role } +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (c *CreateRunnerGroupRequest) GetAllowsPublicRepositories() bool { + if c == nil || c.AllowsPublicRepositories == nil { + return false + } + return *c.AllowsPublicRepositories +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (c *CreateRunnerGroupRequest) GetName() string { if c == nil || c.Name == nil { @@ -2996,6 +3380,14 @@ func (d *DeployKeyEvent) GetAction() string { return *d.Action } +// GetInstallation returns the Installation field. +func (d *DeployKeyEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + // GetKey returns the Key field. func (d *DeployKeyEvent) GetKey() *Key { if d == nil { @@ -4124,6 +4516,22 @@ func (f *ForkEvent) GetSender() *User { return f.Sender } +// GetPreviousTagName returns the PreviousTagName field if it's non-nil, zero value otherwise. +func (g *GenerateNotesOptions) GetPreviousTagName() string { + if g == nil || g.PreviousTagName == nil { + return "" + } + return *g.PreviousTagName +} + +// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. +func (g *GenerateNotesOptions) GetTargetCommitish() string { + if g == nil || g.TargetCommitish == nil { + return "" + } + return *g.TargetCommitish +} + // GetInclude returns the Include field if it's non-nil, zero value otherwise. func (g *GetAuditLogOptions) GetInclude() string { if g == nil || g.Include == nil { @@ -4460,6 +4868,14 @@ func (g *GitHubAppAuthorizationEvent) GetAction() string { return *g.Action } +// GetInstallation returns the Installation field. +func (g *GitHubAppAuthorizationEvent) GetInstallation() *Installation { + if g == nil { + return nil + } + return g.Installation +} + // GetSender returns the Sender field. func (g *GitHubAppAuthorizationEvent) GetSender() *User { if g == nil { @@ -4628,6 +5044,14 @@ func (g *GPGKey) GetPublicKey() string { return *g.PublicKey } +// GetRawKey returns the RawKey field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetRawKey() string { + if g == nil || g.RawKey == nil { + return "" + } + return *g.RawKey +} + // GetApp returns the App field. func (g *Grant) GetApp() *AuthorizationApp { if g == nil { @@ -4828,6 +5252,14 @@ func (h *HookConfig) GetInsecureSSL() string { return *h.InsecureSSL } +// GetSecret returns the Secret field if it's non-nil, zero value otherwise. +func (h *HookConfig) GetSecret() string { + if h == nil || h.Secret == nil { + return "" + } + return *h.Secret +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (h *HookConfig) GetURL() string { if h == nil || h.URL == nil { @@ -4836,6 +5268,142 @@ func (h *HookConfig) GetURL() string { return *h.URL } +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetAction() string { + if h == nil || h.Action == nil { + return "" + } + return *h.Action +} + +// GetDeliveredAt returns the DeliveredAt field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetDeliveredAt() Timestamp { + if h == nil || h.DeliveredAt == nil { + return Timestamp{} + } + return *h.DeliveredAt +} + +// GetDuration returns the Duration field. +func (h *HookDelivery) GetDuration() *float64 { + if h == nil { + return nil + } + return h.Duration +} + +// GetEvent returns the Event field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetEvent() string { + if h == nil || h.Event == nil { + return "" + } + return *h.Event +} + +// GetGUID returns the GUID field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetGUID() string { + if h == nil || h.GUID == nil { + return "" + } + return *h.GUID +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetID() int64 { + if h == nil || h.ID == nil { + return 0 + } + return *h.ID +} + +// GetInstallationID returns the InstallationID field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetInstallationID() string { + if h == nil || h.InstallationID == nil { + return "" + } + return *h.InstallationID +} + +// GetRedelivery returns the Redelivery field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetRedelivery() bool { + if h == nil || h.Redelivery == nil { + return false + } + return *h.Redelivery +} + +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetRepositoryID() int64 { + if h == nil || h.RepositoryID == nil { + return 0 + } + return *h.RepositoryID +} + +// GetRequest returns the Request field. +func (h *HookDelivery) GetRequest() *HookRequest { + if h == nil { + return nil + } + return h.Request +} + +// GetResponse returns the Response field. +func (h *HookDelivery) GetResponse() *HookResponse { + if h == nil { + return nil + } + return h.Response +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetStatus() string { + if h == nil || h.Status == nil { + return "" + } + return *h.Status +} + +// GetStatusCode returns the StatusCode field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetStatusCode() int { + if h == nil || h.StatusCode == nil { + return 0 + } + return *h.StatusCode +} + +// GetHeaders returns the Headers map if it's non-nil, an empty map otherwise. +func (h *HookRequest) GetHeaders() map[string]string { + if h == nil || h.Headers == nil { + return map[string]string{} + } + return h.Headers +} + +// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise. +func (h *HookRequest) GetRawPayload() json.RawMessage { + if h == nil || h.RawPayload == nil { + return json.RawMessage{} + } + return *h.RawPayload +} + +// GetHeaders returns the Headers map if it's non-nil, an empty map otherwise. +func (h *HookResponse) GetHeaders() map[string]string { + if h == nil || h.Headers == nil { + return map[string]string{} + } + return h.Headers +} + +// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise. +func (h *HookResponse) GetRawPayload() json.RawMessage { + if h == nil || h.RawPayload == nil { + return json.RawMessage{} + } + return *h.RawPayload +} + // GetActiveHooks returns the ActiveHooks field if it's non-nil, zero value otherwise. func (h *HookStats) GetActiveHooks() int { if h == nil || h.ActiveHooks == nil { @@ -6020,6 +6588,14 @@ func (i *IssueCommentEvent) GetIssue() *Issue { return i.Issue } +// GetOrganization returns the Organization field. +func (i *IssueCommentEvent) GetOrganization() *Organization { + if i == nil { + return nil + } + return i.Organization +} + // GetRepo returns the Repo field. func (i *IssueCommentEvent) GetRepo() *Repository { if i == nil { @@ -6956,6 +7532,70 @@ func (l *ListRepositories) GetTotalCount() int { return *l.TotalCount } +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (l *ListSCIMProvisionedIdentitiesOptions) GetCount() int { + if l == nil || l.Count == nil { + return 0 + } + return *l.Count +} + +// GetFilter returns the Filter field if it's non-nil, zero value otherwise. +func (l *ListSCIMProvisionedIdentitiesOptions) GetFilter() string { + if l == nil || l.Filter == nil { + return "" + } + return *l.Filter +} + +// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. +func (l *ListSCIMProvisionedIdentitiesOptions) GetStartIndex() int { + if l == nil || l.StartIndex == nil { + return 0 + } + return *l.StartIndex +} + +// GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. +func (l *Location) GetEndColumn() int { + if l == nil || l.EndColumn == nil { + return 0 + } + return *l.EndColumn +} + +// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. +func (l *Location) GetEndLine() int { + if l == nil || l.EndLine == nil { + return 0 + } + return *l.EndLine +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (l *Location) GetPath() string { + if l == nil || l.Path == nil { + return "" + } + return *l.Path +} + +// GetStartColumn returns the StartColumn field if it's non-nil, zero value otherwise. +func (l *Location) GetStartColumn() int { + if l == nil || l.StartColumn == nil { + return 0 + } + return *l.StartColumn +} + +// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. +func (l *Location) GetStartLine() int { + if l == nil || l.StartLine == nil { + return 0 + } + return *l.StartLine +} + // GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. func (m *MarketplacePendingChange) GetEffectiveDate() Timestamp { if m == nil || m.EffectiveDate == nil { @@ -7404,6 +8044,14 @@ func (m *MembershipEvent) GetTeam() *Team { return m.Team } +// GetText returns the Text field if it's non-nil, zero value otherwise. +func (m *Message) GetText() string { + if m == nil || m.Text == nil { + return "" + } + return *m.Text +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (m *MetaEvent) GetAction() string { if m == nil || m.Action == nil { @@ -7428,6 +8076,14 @@ func (m *MetaEvent) GetHookID() int64 { return *m.HookID } +// GetInstallation returns the Installation field. +func (m *MetaEvent) GetInstallation() *Installation { + if m == nil { + return nil + } + return m.Installation +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (m *Metric) GetHTMLURL() string { if m == nil || m.HTMLURL == nil { @@ -7452,6 +8108,22 @@ func (m *Metric) GetName() string { return *m.Name } +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (m *Metric) GetNodeID() string { + if m == nil || m.NodeID == nil { + return "" + } + return *m.NodeID +} + +// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. +func (m *Metric) GetSPDXID() string { + if m == nil || m.SPDXID == nil { + return "" + } + return *m.SPDXID +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (m *Metric) GetURL() string { if m == nil || m.URL == nil { @@ -7732,6 +8404,62 @@ func (m *MilestoneStats) GetTotalMilestones() int { return *m.TotalMilestones } +// GetAnalysisKey returns the AnalysisKey field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetAnalysisKey() string { + if m == nil || m.AnalysisKey == nil { + return "" + } + return *m.AnalysisKey +} + +// GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetCommitSHA() string { + if m == nil || m.CommitSHA == nil { + return "" + } + return *m.CommitSHA +} + +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetEnvironment() string { + if m == nil || m.Environment == nil { + return "" + } + return *m.Environment +} + +// GetLocation returns the Location field. +func (m *MostRecentInstance) GetLocation() *Location { + if m == nil { + return nil + } + return m.Location +} + +// GetMessage returns the Message field. +func (m *MostRecentInstance) GetMessage() *Message { + if m == nil { + return nil + } + return m.Message +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetRef() string { + if m == nil || m.Ref == nil { + return "" + } + return *m.Ref +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetState() string { + if m == nil || m.State == nil { + return "" + } + return *m.State +} + // GetBase returns the Base field if it's non-nil, zero value otherwise. func (n *NewPullRequest) GetBase() string { if n == nil || n.Base == nil { @@ -8516,6 +9244,14 @@ func (p *Package) GetRegistry() *PackageRegistry { return p.Registry } +// GetRepository returns the Repository field. +func (p *Package) GetRepository() *Repository { + if p == nil { + return nil + } + return p.Repository +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (p *Package) GetUpdatedAt() Timestamp { if p == nil || p.UpdatedAt == nil { @@ -8524,6 +9260,30 @@ func (p *Package) GetUpdatedAt() Timestamp { return *p.UpdatedAt } +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *Package) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetVersionCount returns the VersionCount field if it's non-nil, zero value otherwise. +func (p *Package) GetVersionCount() int64 { + if p == nil || p.VersionCount == nil { + return 0 + } + return *p.VersionCount +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (p *Package) GetVisibility() string { + if p == nil || p.Visibility == nil { + return "" + } + return *p.Visibility +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (p *PackageEvent) GetAction() string { if p == nil || p.Action == nil { @@ -8532,6 +9292,14 @@ func (p *PackageEvent) GetAction() string { return *p.Action } +// GetInstallation returns the Installation field. +func (p *PackageEvent) GetInstallation() *Installation { + if p == nil { + return nil + } + return p.Installation +} + // GetOrg returns the Org field. func (p *PackageEvent) GetOrg() *Organization { if p == nil { @@ -8660,6 +9428,46 @@ func (p *PackageFile) GetUpdatedAt() Timestamp { return *p.UpdatedAt } +// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. +func (p *PackageListOptions) GetPackageType() string { + if p == nil || p.PackageType == nil { + return "" + } + return *p.PackageType +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (p *PackageListOptions) GetState() string { + if p == nil || p.State == nil { + return "" + } + return *p.State +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (p *PackageListOptions) GetVisibility() string { + if p == nil || p.Visibility == nil { + return "" + } + return *p.Visibility +} + +// GetContainer returns the Container field. +func (p *PackageMetadata) GetContainer() *PackageContainerMetadata { + if p == nil { + return nil + } + return p.Container +} + +// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. +func (p *PackageMetadata) GetPackageType() string { + if p == nil || p.PackageType == nil { + return "" + } + return *p.PackageType +} + // GetAboutURL returns the AboutURL field if it's non-nil, zero value otherwise. func (p *PackageRegistry) GetAboutURL() string { if p == nil || p.AboutURL == nil { @@ -8860,6 +9668,30 @@ func (p *PackageVersion) GetManifest() string { return *p.Manifest } +// GetMetadata returns the Metadata field. +func (p *PackageVersion) GetMetadata() *PackageMetadata { + if p == nil { + return nil + } + return p.Metadata +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetPackageHTMLURL returns the PackageHTMLURL field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetPackageHTMLURL() string { + if p == nil || p.PackageHTMLURL == nil { + return "" + } + return *p.PackageHTMLURL +} + // GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise. func (p *PackageVersion) GetPrerelease() bool { if p == nil || p.Prerelease == nil { @@ -8916,6 +9748,14 @@ func (p *PackageVersion) GetUpdatedAt() Timestamp { return *p.UpdatedAt } +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + // GetVersion returns the Version field if it's non-nil, zero value otherwise. func (p *PackageVersion) GetVersion() string { if p == nil || p.Version == nil { @@ -10036,6 +10876,22 @@ func (p *Protection) GetRestrictions() *BranchRestrictions { return p.Restrictions } +// GetAuthorizedActorNames returns the AuthorizedActorNames field. +func (p *ProtectionChanges) GetAuthorizedActorNames() *AuthorizedActorNames { + if p == nil { + return nil + } + return p.AuthorizedActorNames +} + +// GetAuthorizedActorsOnly returns the AuthorizedActorsOnly field. +func (p *ProtectionChanges) GetAuthorizedActorsOnly() *AuthorizedActorsOnly { + if p == nil { + return nil + } + return p.AuthorizedActorsOnly +} + // GetAllowDeletions returns the AllowDeletions field if it's non-nil, zero value otherwise. func (p *ProtectionRequest) GetAllowDeletions() bool { if p == nil || p.AllowDeletions == nil { @@ -10052,6 +10908,14 @@ func (p *ProtectionRequest) GetAllowForcePushes() bool { return *p.AllowForcePushes } +// GetRequiredConversationResolution returns the RequiredConversationResolution field if it's non-nil, zero value otherwise. +func (p *ProtectionRequest) GetRequiredConversationResolution() bool { + if p == nil || p.RequiredConversationResolution == nil { + return false + } + return *p.RequiredConversationResolution +} + // GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field. func (p *ProtectionRequest) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcementRequest { if p == nil { @@ -11492,6 +12356,14 @@ func (p *PushEvent) GetInstallation() *Installation { return p.Installation } +// GetOrganization returns the Organization field. +func (p *PushEvent) GetOrganization() *Organization { + if p == nil { + return nil + } + return p.Organization +} + // GetPusher returns the Pusher field. func (p *PushEvent) GetPusher() *User { if p == nil { @@ -12228,6 +13100,14 @@ func (r *RepositoriesSearchResult) GetTotal() int { return *r.Total } +// GetAllowAutoMerge returns the AllowAutoMerge field if it's non-nil, zero value otherwise. +func (r *Repository) GetAllowAutoMerge() bool { + if r == nil || r.AllowAutoMerge == nil { + return false + } + return *r.AllowAutoMerge +} + // GetAllowMergeCommit returns the AllowMergeCommit field if it's non-nil, zero value otherwise. func (r *Repository) GetAllowMergeCommit() bool { if r == nil || r.AllowMergeCommit == nil { @@ -13596,6 +14476,14 @@ func (r *RepositoryRelease) GetDraft() bool { return *r.Draft } +// GetGenerateReleaseNotes returns the GenerateReleaseNotes field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetGenerateReleaseNotes() bool { + if r == nil || r.GenerateReleaseNotes == nil { + return false + } + return *r.GenerateReleaseNotes +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (r *RepositoryRelease) GetHTMLURL() string { if r == nil || r.HTMLURL == nil { @@ -13836,6 +14724,14 @@ func (r *RepositoryVulnerabilityAlertEvent) GetAlert() *RepositoryVulnerabilityA return r.Alert } +// GetInstallation returns the Installation field. +func (r *RepositoryVulnerabilityAlertEvent) GetInstallation() *Installation { + if r == nil { + return nil + } + return r.Installation +} + // GetRepository returns the Repository field. func (r *RepositoryVulnerabilityAlertEvent) GetRepository() *Repository { if r == nil { @@ -13892,6 +14788,14 @@ func (r *RepoStats) GetTotalWikis() int { return *r.TotalWikis } +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetAvatarURL() string { + if r == nil || r.AvatarURL == nil { + return "" + } + return *r.AvatarURL +} + // GetContext returns the Context field if it's non-nil, zero value otherwise. func (r *RepoStatus) GetContext() string { if r == nil || r.Context == nil { @@ -13996,6 +14900,62 @@ func (r *ReviewersRequest) GetNodeID() string { return *r.NodeID } +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (r *Rule) GetDescription() string { + if r == nil || r.Description == nil { + return "" + } + return *r.Description +} + +// GetFullDescription returns the FullDescription field if it's non-nil, zero value otherwise. +func (r *Rule) GetFullDescription() string { + if r == nil || r.FullDescription == nil { + return "" + } + return *r.FullDescription +} + +// GetHelp returns the Help field if it's non-nil, zero value otherwise. +func (r *Rule) GetHelp() string { + if r == nil || r.Help == nil { + return "" + } + return *r.Help +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *Rule) GetID() string { + if r == nil || r.ID == nil { + return "" + } + return *r.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *Rule) GetName() string { + if r == nil || r.Name == nil { + return "" + } + return *r.Name +} + +// GetSecuritySeverityLevel returns the SecuritySeverityLevel field if it's non-nil, zero value otherwise. +func (r *Rule) GetSecuritySeverityLevel() string { + if r == nil || r.SecuritySeverityLevel == nil { + return "" + } + return *r.SecuritySeverityLevel +} + +// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. +func (r *Rule) GetSeverity() string { + if r == nil || r.Severity == nil { + return "" + } + return *r.Severity +} + // GetBusy returns the Busy field if it's non-nil, zero value otherwise. func (r *Runner) GetBusy() bool { if r == nil || r.Busy == nil { @@ -14172,6 +15132,54 @@ func (r *RunnerLabels) GetType() string { return *r.Type } +// GetActive returns the Active field if it's non-nil, zero value otherwise. +func (s *SCIMUserAttributes) GetActive() bool { + if s == nil || s.Active == nil { + return false + } + return *s.Active +} + +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (s *SCIMUserAttributes) GetDisplayName() string { + if s == nil || s.DisplayName == nil { + return "" + } + return *s.DisplayName +} + +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (s *SCIMUserAttributes) GetExternalID() string { + if s == nil || s.ExternalID == nil { + return "" + } + return *s.ExternalID +} + +// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. +func (s *SCIMUserEmail) GetPrimary() bool { + if s == nil || s.Primary == nil { + return false + } + return *s.Primary +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (s *SCIMUserEmail) GetType() string { + if s == nil || s.Type == nil { + return "" + } + return *s.Type +} + +// GetFormatted returns the Formatted field if it's non-nil, zero value otherwise. +func (s *SCIMUserName) GetFormatted() string { + if s == nil || s.Formatted == nil { + return "" + } + return *s.Formatted +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (s *SelectedReposList) GetTotalCount() int { if s == nil || s.TotalCount == nil { @@ -14340,6 +15348,14 @@ func (s *StarEvent) GetAction() string { return *s.Action } +// GetInstallation returns the Installation field. +func (s *StarEvent) GetInstallation() *Installation { + if s == nil { + return nil + } + return s.Installation +} + // GetOrg returns the Org field. func (s *StarEvent) GetOrg() *Organization { if s == nil { @@ -15716,6 +16732,14 @@ func (t *TreeEntry) GetURL() string { return *t.URL } +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (u *UpdateAttributeForSCIMUserOperations) GetPath() string { + if u == nil || u.Path == nil { + return "" + } + return *u.Path +} + // GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. func (u *UpdateCheckRunOptions) GetCompletedAt() Timestamp { if u == nil || u.CompletedAt == nil { @@ -15764,6 +16788,14 @@ func (u *UpdateCheckRunOptions) GetStatus() string { return *u.Status } +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (u *UpdateRunnerGroupRequest) GetAllowsPublicRepositories() bool { + if u == nil || u.AllowsPublicRepositories == nil { + return false + } + return *u.AllowsPublicRepositories +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (u *UpdateRunnerGroupRequest) GetName() string { if u == nil || u.Name == nil { @@ -16268,6 +17300,14 @@ func (u *UserEvent) GetEnterprise() *Enterprise { return u.Enterprise } +// GetInstallation returns the Installation field. +func (u *UserEvent) GetInstallation() *Installation { + if u == nil { + return nil + } + return u.Installation +} + // GetSender returns the Sender field. func (u *UserEvent) GetSender() *User { if u == nil { @@ -16884,6 +17924,14 @@ func (w *WorkflowBill) GetTotalMS() int64 { return *w.TotalMS } +// GetInstallation returns the Installation field. +func (w *WorkflowDispatchEvent) GetInstallation() *Installation { + if w == nil { + return nil + } + return w.Installation +} + // GetOrg returns the Org field. func (w *WorkflowDispatchEvent) GetOrg() *Organization { if w == nil { @@ -17052,6 +18100,54 @@ func (w *WorkflowJob) GetURL() string { return *w.URL } +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (w *WorkflowJobEvent) GetAction() string { + if w == nil || w.Action == nil { + return "" + } + return *w.Action +} + +// GetInstallation returns the Installation field. +func (w *WorkflowJobEvent) GetInstallation() *Installation { + if w == nil { + return nil + } + return w.Installation +} + +// GetOrg returns the Org field. +func (w *WorkflowJobEvent) GetOrg() *Organization { + if w == nil { + return nil + } + return w.Org +} + +// GetRepo returns the Repo field. +func (w *WorkflowJobEvent) GetRepo() *Repository { + if w == nil { + return nil + } + return w.Repo +} + +// GetSender returns the Sender field. +func (w *WorkflowJobEvent) GetSender() *User { + if w == nil { + return nil + } + return w.Sender +} + +// GetWorkflowJob returns the WorkflowJob field. +func (w *WorkflowJobEvent) GetWorkflowJob() *WorkflowJob { + if w == nil { + return nil + } + return w.WorkflowJob +} + // GetArtifactsURL returns the ArtifactsURL field if it's non-nil, zero value otherwise. func (w *WorkflowRun) GetArtifactsURL() string { if w == nil || w.ArtifactsURL == nil { @@ -17068,6 +18164,22 @@ func (w *WorkflowRun) GetCancelURL() string { return *w.CancelURL } +// GetCheckSuiteID returns the CheckSuiteID field if it's non-nil, zero value otherwise. +func (w *WorkflowRun) GetCheckSuiteID() int64 { + if w == nil || w.CheckSuiteID == nil { + return 0 + } + return *w.CheckSuiteID +} + +// GetCheckSuiteNodeID returns the CheckSuiteNodeID field if it's non-nil, zero value otherwise. +func (w *WorkflowRun) GetCheckSuiteNodeID() string { + if w == nil || w.CheckSuiteNodeID == nil { + return "" + } + return *w.CheckSuiteNodeID +} + // GetCheckSuiteURL returns the CheckSuiteURL field if it's non-nil, zero value otherwise. func (w *WorkflowRun) GetCheckSuiteURL() string { if w == nil || w.CheckSuiteURL == nil { @@ -17292,6 +18404,14 @@ func (w *WorkflowRunEvent) GetAction() string { return *w.Action } +// GetInstallation returns the Installation field. +func (w *WorkflowRunEvent) GetInstallation() *Installation { + if w == nil { + return nil + } + return w.Installation +} + // GetOrg returns the Org field. func (w *WorkflowRunEvent) GetOrg() *Organization { if w == nil { diff --git a/vendor/github.com/google/go-github/v37/github/github.go b/vendor/github.com/google/go-github/v39/github/github.go similarity index 96% rename from vendor/github.com/google/go-github/v37/github/github.go rename to vendor/github.com/google/go-github/v39/github/github.go index 264e27f476..d4d7a54a7f 100644 --- a/vendor/github.com/google/go-github/v37/github/github.go +++ b/vendor/github.com/google/go-github/v39/github/github.go @@ -37,6 +37,8 @@ const ( headerRateReset = "X-RateLimit-Reset" headerOTP = "X-GitHub-OTP" + headerTokenExpiration = "GitHub-Authentication-Token-Expiration" + mediaTypeV3 = "application/vnd.github.v3+json" defaultMediaType = "application/octet-stream" mediaTypeV3SHA = "application/vnd.github.v3.sha" @@ -74,9 +76,6 @@ const ( // https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/ mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json" - // https://developer.github.com/changes/2017-02-09-community-health/ - mediaTypeRepositoryCommunityHealthMetricsPreview = "application/vnd.github.black-panther-preview+json" - // https://developer.github.com/changes/2017-05-23-coc-api/ mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json" @@ -179,6 +178,7 @@ type Client struct { PullRequests *PullRequestsService Reactions *ReactionsService Repositories *RepositoriesService + SCIM *SCIMService Search *SearchService Teams *TeamsService Users *UsersService @@ -188,6 +188,14 @@ type service struct { client *Client } +// Client returns the http.Client used by this GitHub client. +func (c *Client) Client() *http.Client { + c.clientMu.Lock() + defer c.clientMu.Unlock() + clientCopy := *c.client + return &clientCopy +} + // ListOptions specifies the optional parameters to various List methods that // support offset pagination. type ListOptions struct { @@ -212,6 +220,9 @@ type ListCursorOptions struct { // A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query continues the search using this cursor. + Cursor string `url:"cursor,omitempty"` } // UploadOptions specifies the parameters to methods that support uploads. @@ -295,6 +306,7 @@ func NewClient(httpClient *http.Client) *Client { c.PullRequests = (*PullRequestsService)(&c.common) c.Reactions = (*ReactionsService)(&c.common) c.Repositories = (*RepositoriesService)(&c.common) + c.SCIM = (*SCIMService)(&c.common) c.Search = (*SearchService)(&c.common) c.Teams = (*TeamsService)(&c.common) c.Users = (*UsersService)(&c.common) @@ -445,9 +457,17 @@ type Response struct { // calling the endpoint again. NextPageToken string + // For APIs that support cursor pagination, such as RepositoriesService.ListHookDeliveries, + // the following field will be populated to point to the next page. + // Set ListCursorOptions.Cursor to this value when calling the endpoint again. + Cursor string + // Explicitly specify the Rate type so Rate's String() receiver doesn't // propagate to Response. Rate Rate + + // token's expiration date + TokenExpiration Timestamp } // newResponse creates a new Response for the provided http.Response. @@ -456,6 +476,7 @@ func newResponse(r *http.Response) *Response { response := &Response{Response: r} response.populatePageValues() response.Rate = parseRate(r) + response.TokenExpiration = parseTokenExpiration(r) return response } @@ -481,7 +502,21 @@ func (r *Response) populatePageValues() { if err != nil { continue } - page := url.Query().Get("page") + + q := url.Query() + + if cursor := q.Get("cursor"); cursor != "" { + for _, segment := range segments[1:] { + switch strings.TrimSpace(segment) { + case `rel="next"`: + r.Cursor = cursor + } + } + + continue + } + + page := q.Get("page") if page == "" { continue } @@ -499,7 +534,6 @@ func (r *Response) populatePageValues() { case `rel="last"`: r.LastPage, _ = strconv.Atoi(page) } - } } } @@ -522,6 +556,17 @@ func parseRate(r *http.Response) Rate { return rate } +// parseTokenExpiration parses the TokenExpiration related headers. +func parseTokenExpiration(r *http.Response) Timestamp { + var exp Timestamp + if v := r.Header.Get(headerTokenExpiration); v != "" { + if t, err := time.Parse("2006-01-02 03:04:05 MST", v); err == nil { + exp = Timestamp{t.Local()} + } + } + return exp +} + type requestContext uint8 const ( @@ -663,10 +708,10 @@ func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rat return nil } -// compareHttpResponse returns whether two http.Response objects are equal or not. +// compareHTTPResponse returns whether two http.Response objects are equal or not. // Currently, only StatusCode is checked. This function is used when implementing the // Is(error) bool interface for the custom error types in this package. -func compareHttpResponse(r1, r2 *http.Response) bool { +func compareHTTPResponse(r1, r2 *http.Response) bool { if r1 == nil && r2 == nil { return true } @@ -716,7 +761,7 @@ func (r *ErrorResponse) Is(target error) bool { } if r.Message != v.Message || (r.DocumentationURL != v.DocumentationURL) || - !compareHttpResponse(r.Response, v.Response) { + !compareHTTPResponse(r.Response, v.Response) { return false } @@ -782,7 +827,7 @@ func (r *RateLimitError) Is(target error) bool { return r.Rate == v.Rate && r.Message == v.Message && - compareHttpResponse(r.Response, v.Response) + compareHTTPResponse(r.Response, v.Response) } // AcceptedError occurs when GitHub returns 202 Accepted response with an @@ -836,7 +881,7 @@ func (r *AbuseRateLimitError) Is(target error) bool { return r.Message == v.Message && r.RetryAfter == v.RetryAfter && - compareHttpResponse(r.Response, v.Response) + compareHTTPResponse(r.Response, v.Response) } // sanitizeURL redacts the client_secret parameter from the URL which may be diff --git a/vendor/github.com/google/go-github/v37/github/gitignore.go b/vendor/github.com/google/go-github/v39/github/gitignore.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/gitignore.go rename to vendor/github.com/google/go-github/v39/github/gitignore.go diff --git a/vendor/github.com/google/go-github/v37/github/interactions.go b/vendor/github.com/google/go-github/v39/github/interactions.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/interactions.go rename to vendor/github.com/google/go-github/v39/github/interactions.go diff --git a/vendor/github.com/google/go-github/v37/github/interactions_orgs.go b/vendor/github.com/google/go-github/v39/github/interactions_orgs.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/interactions_orgs.go rename to vendor/github.com/google/go-github/v39/github/interactions_orgs.go diff --git a/vendor/github.com/google/go-github/v37/github/interactions_repos.go b/vendor/github.com/google/go-github/v39/github/interactions_repos.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/interactions_repos.go rename to vendor/github.com/google/go-github/v39/github/interactions_repos.go diff --git a/vendor/github.com/google/go-github/v37/github/issue_import.go b/vendor/github.com/google/go-github/v39/github/issue_import.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/issue_import.go rename to vendor/github.com/google/go-github/v39/github/issue_import.go diff --git a/vendor/github.com/google/go-github/v37/github/issues.go b/vendor/github.com/google/go-github/v39/github/issues.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/issues.go rename to vendor/github.com/google/go-github/v39/github/issues.go diff --git a/vendor/github.com/google/go-github/v37/github/issues_assignees.go b/vendor/github.com/google/go-github/v39/github/issues_assignees.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/issues_assignees.go rename to vendor/github.com/google/go-github/v39/github/issues_assignees.go diff --git a/vendor/github.com/google/go-github/v37/github/issues_comments.go b/vendor/github.com/google/go-github/v39/github/issues_comments.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/issues_comments.go rename to vendor/github.com/google/go-github/v39/github/issues_comments.go diff --git a/vendor/github.com/google/go-github/v37/github/issues_events.go b/vendor/github.com/google/go-github/v39/github/issues_events.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/issues_events.go rename to vendor/github.com/google/go-github/v39/github/issues_events.go diff --git a/vendor/github.com/google/go-github/v37/github/issues_labels.go b/vendor/github.com/google/go-github/v39/github/issues_labels.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/issues_labels.go rename to vendor/github.com/google/go-github/v39/github/issues_labels.go diff --git a/vendor/github.com/google/go-github/v37/github/issues_milestones.go b/vendor/github.com/google/go-github/v39/github/issues_milestones.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/issues_milestones.go rename to vendor/github.com/google/go-github/v39/github/issues_milestones.go diff --git a/vendor/github.com/google/go-github/v37/github/issues_timeline.go b/vendor/github.com/google/go-github/v39/github/issues_timeline.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/issues_timeline.go rename to vendor/github.com/google/go-github/v39/github/issues_timeline.go diff --git a/vendor/github.com/google/go-github/v37/github/licenses.go b/vendor/github.com/google/go-github/v39/github/licenses.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/licenses.go rename to vendor/github.com/google/go-github/v39/github/licenses.go diff --git a/vendor/github.com/google/go-github/v37/github/messages.go b/vendor/github.com/google/go-github/v39/github/messages.go similarity index 80% rename from vendor/github.com/google/go-github/v37/github/messages.go rename to vendor/github.com/google/go-github/v39/github/messages.go index 06ea9e4cfe..4a03890c7b 100644 --- a/vendor/github.com/google/go-github/v37/github/messages.go +++ b/vendor/github.com/google/go-github/v39/github/messages.go @@ -18,6 +18,7 @@ import ( "errors" "fmt" "hash" + "io" "io/ioutil" "mime" "net/http" @@ -31,19 +32,20 @@ const ( // sha256Prefix and sha512Prefix are provided for future compatibility. sha256Prefix = "sha256" sha512Prefix = "sha512" - // sha1SignatureHeader is the GitHub header key used to pass the HMAC-SHA1 hexdigest. - sha1SignatureHeader = "X-Hub-Signature" - // sha256SignatureHeader is the GitHub header key used to pass the HMAC-SHA256 hexdigest. - sha256SignatureHeader = "X-Hub-Signature-256" - // eventTypeHeader is the GitHub header key used to pass the event type. - eventTypeHeader = "X-Github-Event" - // deliveryIDHeader is the GitHub header key used to pass the unique ID for the webhook event. - deliveryIDHeader = "X-Github-Delivery" + // SHA1SignatureHeader is the GitHub header key used to pass the HMAC-SHA1 hexdigest. + SHA1SignatureHeader = "X-Hub-Signature" + // SHA256SignatureHeader is the GitHub header key used to pass the HMAC-SHA256 hexdigest. + SHA256SignatureHeader = "X-Hub-Signature-256" + // EventTypeHeader is the GitHub header key used to pass the event type. + EventTypeHeader = "X-Github-Event" + // DeliveryIDHeader is the GitHub header key used to pass the unique ID for the webhook event. + DeliveryIDHeader = "X-Github-Delivery" ) var ( // eventTypeMapping maps webhooks types to their corresponding go-github struct types. eventTypeMapping = map[string]string{ + "branch_protection_rule": "BranchProtectionRuleEvent", "check_run": "CheckRunEvent", "check_suite": "CheckSuiteEvent", "commit_comment": "CommitCommentEvent", @@ -91,6 +93,7 @@ var ( "user": "UserEvent", "watch": "WatchEvent", "workflow_dispatch": "WorkflowDispatchEvent", + "workflow_job": "WorkflowJobEvent", "workflow_run": "WorkflowRunEvent", } ) @@ -139,6 +142,70 @@ func messageMAC(signature string) ([]byte, func() hash.Hash, error) { return buf, hashFunc, nil } +// ValidatePayload validates an incoming GitHub Webhook event request body +// and returns the (JSON) payload. +// The Content-Type header of the payload can be "application/json" or "application/x-www-form-urlencoded". +// If the Content-Type is neither then an error is returned. +// secretToken is the GitHub Webhook secret token. +// If your webhook does not contain a secret token, you can pass nil or an empty slice. +// This is intended for local development purposes only and all webhooks should ideally set up a secret token. +// +// Example usage: +// +// func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) { +// // read signature from request +// signature := "" +// payload, err := github.ValidatePayloadFromBody(r.Header.Get("Content-Type"), r.Body, signature, s.webhookSecretKey) +// if err != nil { ... } +// // Process payload... +// } +func ValidatePayloadFromBody(contentType string, readable io.Reader, signature string, secretToken []byte) (payload []byte, err error) { + var body []byte // Raw body that GitHub uses to calculate the signature. + + switch contentType { + case "application/json": + var err error + if body, err = ioutil.ReadAll(readable); err != nil { + return nil, err + } + + // If the content type is application/json, + // the JSON payload is just the original body. + payload = body + + case "application/x-www-form-urlencoded": + // payloadFormParam is the name of the form parameter that the JSON payload + // will be in if a webhook has its content type set to application/x-www-form-urlencoded. + const payloadFormParam = "payload" + + var err error + if body, err = ioutil.ReadAll(readable); err != nil { + return nil, err + } + + // If the content type is application/x-www-form-urlencoded, + // the JSON payload will be under the "payload" form param. + form, err := url.ParseQuery(string(body)) + if err != nil { + return nil, err + } + payload = []byte(form.Get(payloadFormParam)) + + default: + return nil, fmt.Errorf("webhook request has unsupported Content-Type %q", contentType) + } + + // Only validate the signature if a secret token exists. This is intended for + // local development only and all webhooks should ideally set up a secret token. + if len(secretToken) > 0 { + if err := ValidateSignature(signature, body, secretToken); err != nil { + return nil, err + } + } + + return payload, nil +} + // ValidatePayload validates an incoming GitHub Webhook event request // and returns the (JSON) payload. // The Content-Type header of the payload can be "application/json" or "application/x-www-form-urlencoded". @@ -156,61 +223,17 @@ func messageMAC(signature string) ([]byte, func() hash.Hash, error) { // } // func ValidatePayload(r *http.Request, secretToken []byte) (payload []byte, err error) { - var body []byte // Raw body that GitHub uses to calculate the signature. + signature := r.Header.Get(SHA256SignatureHeader) + if signature == "" { + signature = r.Header.Get(SHA1SignatureHeader) + } - ct := r.Header.Get("Content-Type") - - mediatype, _, err := mime.ParseMediaType(ct) + contentType, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) if err != nil { - mediatype = "" + return nil, err } - switch mediatype { - case "application/json": - var err error - if body, err = ioutil.ReadAll(r.Body); err != nil { - return nil, err - } - - // If the content type is application/json, - // the JSON payload is just the original body. - payload = body - - case "application/x-www-form-urlencoded": - // payloadFormParam is the name of the form parameter that the JSON payload - // will be in if a webhook has its content type set to application/x-www-form-urlencoded. - const payloadFormParam = "payload" - - var err error - if body, err = ioutil.ReadAll(r.Body); err != nil { - return nil, err - } - - // If the content type is application/x-www-form-urlencoded, - // the JSON payload will be under the "payload" form param. - form, err := url.ParseQuery(string(body)) - if err != nil { - return nil, err - } - payload = []byte(form.Get(payloadFormParam)) - - default: - return nil, fmt.Errorf("Webhook request has unsupported Content-Type %q", ct) - } - - // Only validate the signature if a secret token exists. This is intended for - // local development only and all webhooks should ideally set up a secret token. - if len(secretToken) > 0 { - sig := r.Header.Get(sha256SignatureHeader) - if sig == "" { - sig = r.Header.Get(sha1SignatureHeader) - } - if err := ValidateSignature(sig, body, secretToken); err != nil { - return nil, err - } - } - - return payload, nil + return ValidatePayloadFromBody(contentType, r.Body, signature, secretToken) } // ValidateSignature validates the signature for the given payload. @@ -234,14 +257,14 @@ func ValidateSignature(signature string, payload, secretToken []byte) error { // // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/hooks/#webhook-headers func WebHookType(r *http.Request) string { - return r.Header.Get(eventTypeHeader) + return r.Header.Get(EventTypeHeader) } // DeliveryID returns the unique delivery ID of webhook request r. // // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/hooks/#webhook-headers func DeliveryID(r *http.Request) string { - return r.Header.Get(deliveryIDHeader) + return r.Header.Get(DeliveryIDHeader) } // ParseWebHook parses the event payload. For recognized event types, a diff --git a/vendor/github.com/google/go-github/v37/github/migrations.go b/vendor/github.com/google/go-github/v39/github/migrations.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/migrations.go rename to vendor/github.com/google/go-github/v39/github/migrations.go diff --git a/vendor/github.com/google/go-github/v37/github/migrations_source_import.go b/vendor/github.com/google/go-github/v39/github/migrations_source_import.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/migrations_source_import.go rename to vendor/github.com/google/go-github/v39/github/migrations_source_import.go diff --git a/vendor/github.com/google/go-github/v37/github/migrations_user.go b/vendor/github.com/google/go-github/v39/github/migrations_user.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/migrations_user.go rename to vendor/github.com/google/go-github/v39/github/migrations_user.go diff --git a/vendor/github.com/google/go-github/v37/github/misc.go b/vendor/github.com/google/go-github/v39/github/misc.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/misc.go rename to vendor/github.com/google/go-github/v39/github/misc.go diff --git a/vendor/github.com/google/go-github/v37/github/orgs.go b/vendor/github.com/google/go-github/v39/github/orgs.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/orgs.go rename to vendor/github.com/google/go-github/v39/github/orgs.go diff --git a/vendor/github.com/google/go-github/v37/github/orgs_actions_allowed.go b/vendor/github.com/google/go-github/v39/github/orgs_actions_allowed.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/orgs_actions_allowed.go rename to vendor/github.com/google/go-github/v39/github/orgs_actions_allowed.go diff --git a/vendor/github.com/google/go-github/v37/github/orgs_actions_permissions.go b/vendor/github.com/google/go-github/v39/github/orgs_actions_permissions.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/orgs_actions_permissions.go rename to vendor/github.com/google/go-github/v39/github/orgs_actions_permissions.go diff --git a/vendor/github.com/google/go-github/v37/github/orgs_audit_log.go b/vendor/github.com/google/go-github/v39/github/orgs_audit_log.go similarity index 97% rename from vendor/github.com/google/go-github/v37/github/orgs_audit_log.go rename to vendor/github.com/google/go-github/v39/github/orgs_audit_log.go index 81f0edac9b..4b98ba690e 100644 --- a/vendor/github.com/google/go-github/v37/github/orgs_audit_log.go +++ b/vendor/github.com/google/go-github/v39/github/orgs_audit_log.go @@ -24,6 +24,9 @@ type HookConfig struct { ContentType *string `json:"content_type,omitempty"` InsecureSSL *string `json:"insecure_ssl,omitempty"` URL *string `json:"url,omitempty"` + + // Secret is returned obfuscated by GitHub, but it can be set for outgoing requests. + Secret *string `json:"secret,omitempty"` } // AuditEntry describes the fields that may be represented by various audit-log "action" entries. diff --git a/vendor/github.com/google/go-github/v37/github/orgs_hooks.go b/vendor/github.com/google/go-github/v39/github/orgs_hooks.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/orgs_hooks.go rename to vendor/github.com/google/go-github/v39/github/orgs_hooks.go diff --git a/vendor/github.com/google/go-github/v39/github/orgs_hooks_deliveries.go b/vendor/github.com/google/go-github/v39/github/orgs_hooks_deliveries.go new file mode 100644 index 0000000000..d1fb5c832a --- /dev/null +++ b/vendor/github.com/google/go-github/v39/github/orgs_hooks_deliveries.go @@ -0,0 +1,73 @@ +// Copyright 2021 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" +) + +// ListHookDeliveries lists webhook deliveries for a webhook configured in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#list-deliveries-for-an-organization-webhook +func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { + u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries", org, id) + 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 + } + + deliveries := []*HookDelivery{} + resp, err := s.client.Do(ctx, req, &deliveries) + if err != nil { + return nil, resp, err + } + + return deliveries, resp, nil +} + +// GetHookDelivery returns a delivery for a webhook configured in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#get-a-webhook-delivery-for-an-organization-webhook +func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { + u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v", owner, hookID, deliveryID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + h := new(HookDelivery) + resp, err := s.client.Do(ctx, req, h) + if err != nil { + return nil, resp, err + } + + return h, resp, nil +} + +// RedeliverHookDelivery redelivers a delivery for a webhook configured in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/orgs#redeliver-a-delivery-for-an-organization-webhook +func (s *OrganizationsService) RedeliverHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { + u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v/attempts", owner, hookID, deliveryID) + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, nil, err + } + + h := new(HookDelivery) + resp, err := s.client.Do(ctx, req, h) + if err != nil { + return nil, resp, err + } + + return h, resp, nil +} diff --git a/vendor/github.com/google/go-github/v37/github/orgs_members.go b/vendor/github.com/google/go-github/v39/github/orgs_members.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/orgs_members.go rename to vendor/github.com/google/go-github/v39/github/orgs_members.go diff --git a/vendor/github.com/google/go-github/v37/github/orgs_outside_collaborators.go b/vendor/github.com/google/go-github/v39/github/orgs_outside_collaborators.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/orgs_outside_collaborators.go rename to vendor/github.com/google/go-github/v39/github/orgs_outside_collaborators.go diff --git a/vendor/github.com/google/go-github/v39/github/orgs_packages.go b/vendor/github.com/google/go-github/v39/github/orgs_packages.go new file mode 100644 index 0000000000..0c36f21cae --- /dev/null +++ b/vendor/github.com/google/go-github/v39/github/orgs_packages.go @@ -0,0 +1,149 @@ +// Copyright 2021 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" +) + +// List the packages for an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#list-packages-for-an-organization +func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opts *PackageListOptions) ([]*Package, *Response, error) { + u := fmt.Sprintf("orgs/%v/packages", org) + 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 packages []*Package + resp, err := s.client.Do(ctx, req, &packages) + if err != nil { + return nil, resp, err + } + + return packages, resp, nil +} + +// Get a package by name from an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-for-an-organization +func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) { + u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var pack *Package + resp, err := s.client.Do(ctx, req, &pack) + if err != nil { + return nil, resp, err + } + + return pack, resp, nil +} + +// Delete a package from an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-a-package-for-an-organization +func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// Restore a package to an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-a-package-for-an-organization +func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, packageName) + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// Get all versions of a package in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-all-package-versions-for-a-package-owned-by-an-organization +func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { + u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions", org, packageType, packageName) + 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 versions []*PackageVersion + resp, err := s.client.Do(ctx, req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + +// Get a specific version of a package in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-version-for-an-organization +func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { + u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var version *PackageVersion + resp, err := s.client.Do(ctx, req, &version) + if err != nil { + return nil, resp, err + } + + return version, resp, nil +} + +// Delete a package version from an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-package-version-for-an-organization +func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// Restore a package version to an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-package-version-for-an-organization +func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, packageName, packageVersionID) + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v37/github/orgs_projects.go b/vendor/github.com/google/go-github/v39/github/orgs_projects.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/orgs_projects.go rename to vendor/github.com/google/go-github/v39/github/orgs_projects.go diff --git a/vendor/github.com/google/go-github/v37/github/orgs_users_blocking.go b/vendor/github.com/google/go-github/v39/github/orgs_users_blocking.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/orgs_users_blocking.go rename to vendor/github.com/google/go-github/v39/github/orgs_users_blocking.go diff --git a/vendor/github.com/google/go-github/v37/github/packages.go b/vendor/github.com/google/go-github/v39/github/packages.go similarity index 52% rename from vendor/github.com/google/go-github/v37/github/packages.go rename to vendor/github.com/google/go-github/v39/github/packages.go index 446e4faa23..ef7df07405 100644 --- a/vendor/github.com/google/go-github/v37/github/packages.go +++ b/vendor/github.com/google/go-github/v39/github/packages.go @@ -16,6 +16,10 @@ type Package struct { Owner *User `json:"owner,omitempty"` PackageVersion *PackageVersion `json:"package_version,omitempty"` Registry *PackageRegistry `json:"registry,omitempty"` + URL *string `json:"url,omitempty"` + VersionCount *int64 `json:"version_count,omitempty"` + Visibility *string `json:"visibility,omitempty"` + Repository *Repository `json:"repository,omitempty"` } func (p Package) String() string { @@ -24,24 +28,28 @@ func (p Package) String() string { // PackageVersion represents a GitHub package version. type PackageVersion struct { - ID *int64 `json:"id,omitempty"` - Version *string `json:"version,omitempty"` - Summary *string `json:"summary,omitempty"` - Body *string `json:"body,omitempty"` - BodyHTML *string `json:"body_html,omitempty"` - Release *PackageRelease `json:"release,omitempty"` - Manifest *string `json:"manifest,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - TagName *string `json:"tag_name,omitempty"` - TargetCommitish *string `json:"target_commitish,omitempty"` - TargetOID *string `json:"target_oid,omitempty"` - Draft *bool `json:"draft,omitempty"` - Prerelease *bool `json:"prerelease,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - PackageFiles []*PackageFile `json:"package_files,omitempty"` - Author *User `json:"author,omitempty"` - InstallationCommand *string `json:"installation_command,omitempty"` + ID *int64 `json:"id,omitempty"` + Version *string `json:"version,omitempty"` + Summary *string `json:"summary,omitempty"` + Body *string `json:"body,omitempty"` + BodyHTML *string `json:"body_html,omitempty"` + Release *PackageRelease `json:"release,omitempty"` + Manifest *string `json:"manifest,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + TagName *string `json:"tag_name,omitempty"` + TargetCommitish *string `json:"target_commitish,omitempty"` + TargetOID *string `json:"target_oid,omitempty"` + Draft *bool `json:"draft,omitempty"` + Prerelease *bool `json:"prerelease,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + PackageFiles []*PackageFile `json:"package_files,omitempty"` + Author *User `json:"author,omitempty"` + InstallationCommand *string `json:"installation_command,omitempty"` + Metadata *PackageMetadata `json:"metadata,omitempty"` + PackageHTMLURL *string `json:"package_html_url,omitempty"` + Name *string `json:"name,omitempty"` + URL *string `json:"url,omitempty"` } func (pv PackageVersion) String() string { @@ -99,3 +107,37 @@ type PackageRegistry struct { func (r PackageRegistry) String() string { return Stringify(r) } + +// PackageListOptions represents the optional list options for a package. +type PackageListOptions struct { + // Visibility of packages "public", "internal" or "private". + Visibility *string `url:"visibility,omitempty"` + + // PackageType represents the type of package. + // It can be one of "npm", "maven", "rubygems", "nuget", "docker", or "container". + PackageType *string `url:"package_type,omitempty"` + + // State of package either "active" or "deleted". + State *string `url:"state,omitempty"` + + ListOptions +} + +// PackageMetadata represents metadata from a package. +type PackageMetadata struct { + PackageType *string `json:"package_type,omitempty"` + Container *PackageContainerMetadata `json:"container,omitempty"` +} + +func (r PackageMetadata) String() string { + return Stringify(r) +} + +// PackageContainerMetadata represents container metadata for docker container packages. +type PackageContainerMetadata struct { + Tags []string `json:"tags,omitempty"` +} + +func (r PackageContainerMetadata) String() string { + return Stringify(r) +} diff --git a/vendor/github.com/google/go-github/v37/github/projects.go b/vendor/github.com/google/go-github/v39/github/projects.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/projects.go rename to vendor/github.com/google/go-github/v39/github/projects.go diff --git a/vendor/github.com/google/go-github/v37/github/pulls.go b/vendor/github.com/google/go-github/v39/github/pulls.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/pulls.go rename to vendor/github.com/google/go-github/v39/github/pulls.go diff --git a/vendor/github.com/google/go-github/v37/github/pulls_comments.go b/vendor/github.com/google/go-github/v39/github/pulls_comments.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/pulls_comments.go rename to vendor/github.com/google/go-github/v39/github/pulls_comments.go diff --git a/vendor/github.com/google/go-github/v37/github/pulls_reviewers.go b/vendor/github.com/google/go-github/v39/github/pulls_reviewers.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/pulls_reviewers.go rename to vendor/github.com/google/go-github/v39/github/pulls_reviewers.go diff --git a/vendor/github.com/google/go-github/v37/github/pulls_reviews.go b/vendor/github.com/google/go-github/v39/github/pulls_reviews.go similarity index 88% rename from vendor/github.com/google/go-github/v37/github/pulls_reviews.go rename to vendor/github.com/google/go-github/v39/github/pulls_reviews.go index becd2e0072..437b0937be 100644 --- a/vendor/github.com/google/go-github/v37/github/pulls_reviews.go +++ b/vendor/github.com/google/go-github/v39/github/pulls_reviews.go @@ -125,10 +125,6 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin // GetReview fetches the specified pull request review. // -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#get-a-review-for-a-pull-request func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) @@ -149,10 +145,6 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, // DeletePendingReview deletes the specified pull request pending review. // -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#delete-a-pending-review-for-a-pull-request func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) @@ -173,10 +165,6 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re // ListReviewComments lists all the comments for the specified review. // -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#list-comments-for-a-pull-request-review func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opts *ListOptions) ([]*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID) @@ -201,10 +189,6 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep // CreateReview creates a new review on the specified pull request. // -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#create-a-review-for-a-pull-request // // In order to use multi-line comments, you must use the "comfort fade" preview. @@ -289,10 +273,6 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri // SubmitReview submits a specified review on the specified pull request. // -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#submit-a-review-for-a-pull-request func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID) @@ -313,10 +293,6 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri // DismissReview dismisses a specified review on the specified pull request. // -// TODO: Follow up with GitHub support about an issue with this method's -// returned error format and remove this comment once it's fixed. -// Read more about it here - https://github.com/google/go-github/issues/540 -// // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/pulls/#dismiss-a-review-for-a-pull-request func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID) diff --git a/vendor/github.com/google/go-github/v37/github/reactions.go b/vendor/github.com/google/go-github/v39/github/reactions.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/reactions.go rename to vendor/github.com/google/go-github/v39/github/reactions.go diff --git a/vendor/github.com/google/go-github/v37/github/repos.go b/vendor/github.com/google/go-github/v39/github/repos.go similarity index 94% rename from vendor/github.com/google/go-github/v37/github/repos.go rename to vendor/github.com/google/go-github/v39/github/repos.go index d336e8bf77..f6236b432f 100644 --- a/vendor/github.com/google/go-github/v37/github/repos.go +++ b/vendor/github.com/google/go-github/v39/github/repos.go @@ -60,6 +60,7 @@ type Repository struct { AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` Topics []string `json:"topics,omitempty"` Archived *bool `json:"archived,omitempty"` @@ -320,6 +321,7 @@ type createRepoRequest struct { AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` } @@ -362,6 +364,7 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo AllowSquashMerge: repo.AllowSquashMerge, AllowMergeCommit: repo.AllowMergeCommit, AllowRebaseMerge: repo.AllowRebaseMerge, + AllowAutoMerge: repo.AllowAutoMerge, DeleteBranchOnMerge: repo.DeleteBranchOnMerge, } @@ -764,6 +767,50 @@ type Protection struct { RequiredConversationResolution *RequiredConversationResolution `json:"required_conversation_resolution"` } +// BranchProtectionRule represents the rule applied to a repositories branch. +type BranchProtectionRule struct { + ID *int64 `json:"id,omitempty"` + RepositoryID *int64 `json:"repository_id,omitempty"` + Name *string `json:"name,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + PullRequestReviewsEnforcementLevel *string `json:"pull_request_reviews_enforcement_level,omitempty"` + RequiredApprovingReviewCount *int `json:"required_approving_review_count,omitempty"` + DismissStaleReviewsOnPush *bool `json:"dismiss_stale_reviews_on_push,omitempty"` + AuthorizedDismissalActorsOnly *bool `json:"authorized_dismissal_actors_only,omitempty"` + IgnoreApprovalsFromContributors *bool `json:"ignore_approvals_from_contributors,omitempty"` + RequireCodeOwnerReview *bool `json:"require_code_owner_review,omitempty"` + RequiredStatusChecks []string `json:"required_status_checks,omitempty"` + RequiredStatusChecksEnforcementLevel *string `json:"required_status_checks_enforcement_level,omitempty"` + StrictRequiredStatusChecksPolicy *bool `json:"strict_required_status_checks_policy,omitempty"` + SignatureRequirementEnforcementLevel *string `json:"signature_requirement_enforcement_level,omitempty"` + LinearHistoryRequirementEnforcementLevel *string `json:"linear_history_requirement_enforcement_level,omitempty"` + AdminEnforced *bool `json:"admin_enforced,omitempty"` + AllowForcePushesEnforcementLevel *string `json:"allow_force_pushes_enforcement_level,omitempty"` + AllowDeletionsEnforcementLevel *string `json:"allow_deletions_enforcement_level,omitempty"` + MergeQueueEnforcementLevel *string `json:"merge_queue_enforcement_level,omitempty"` + RequiredDeploymentsEnforcementLevel *string `json:"required_deployments_enforcement_level,omitempty"` + RequiredConversationResolutionLevel *string `json:"required_conversation_resolution_level,omitempty"` + AuthorizedActorsOnly *bool `json:"authorized_actors_only,omitempty"` + AuthorizedActorNames []string `json:"authorized_actor_names,omitempty"` +} + +// ProtectionChanges represents the changes to the rule if the BranchProtection was edited. +type ProtectionChanges struct { + AuthorizedActorsOnly *AuthorizedActorsOnly `json:"authorized_actors_only,omitempty"` + AuthorizedActorNames *AuthorizedActorNames `json:"authorized_actor_names,omitempty"` +} + +// AuthorizedActorNames represents who are authorized to edit the branch protection rules. +type AuthorizedActorNames struct { + From []string `json:"from,omitempty"` +} + +// AuthorizedActorsOnly represents if the branche rule can be edited by authorized actors only. +type AuthorizedActorsOnly struct { + From *bool `json:"from,omitempty"` +} + // ProtectionRequest represents a request to create/edit a branch's protection. type ProtectionRequest struct { RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"` @@ -776,6 +823,9 @@ type ProtectionRequest struct { AllowForcePushes *bool `json:"allow_force_pushes,omitempty"` // Allows deletion of the protected branch by anyone with write access to the repository. AllowDeletions *bool `json:"allow_deletions,omitempty"` + // RequiredConversationResolution, if set to true, requires all comments + // on the pull request to be resolved before it can be merged to a protected branch. + RequiredConversationResolution *bool `json:"required_conversation_resolution,omitempty"` } // RequiredStatusChecks represents the protection status of a individual branch. diff --git a/vendor/github.com/google/go-github/v39/github/repos_autolinks.go b/vendor/github.com/google/go-github/v39/github/repos_autolinks.go new file mode 100644 index 0000000000..b6404783eb --- /dev/null +++ b/vendor/github.com/google/go-github/v39/github/repos_autolinks.go @@ -0,0 +1,102 @@ +// Copyright 2021 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" +) + +// AutolinkOptions specifies parameters for RepositoriesService.AddAutolink method. +type AutolinkOptions struct { + KeyPrefix *string `json:"key_prefix,omitempty"` + URLTemplate *string `json:"url_template,omitempty"` +} + +// Autolink represents autolinks to external resources like JIRA issues and Zendesk tickets. +type Autolink struct { + ID *int64 `json:"id,omitempty"` + KeyPrefix *string `json:"key_prefix,omitempty"` + URLTemplate *string `json:"url_template,omitempty"` +} + +// ListAutolinks returns a list of autolinks configured for the given repository. +// Information about autolinks are only available to repository administrators. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/repos#list-all-autolinks-of-a-repository +func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Autolink, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) + 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 autolinks []*Autolink + resp, err := s.client.Do(ctx, req, &autolinks) + if err != nil { + return nil, resp, err + } + + return autolinks, resp, nil +} + +// AddAutolink creates an autolink reference for a repository. +// Users with admin access to the repository can create an autolink. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/repos#create-an-autolink-reference-for-a-repository +func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, opts *AutolinkOptions) (*Autolink, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + + al := new(Autolink) + resp, err := s.client.Do(ctx, req, al) + if err != nil { + return nil, resp, err + } + return al, resp, nil +} + +// GetAutolink returns a single autolink reference by ID that was configured for the given repository. +// Information about autolinks are only available to repository administrators. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-an-autolink-reference-of-a-repository +func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo string, id int64) (*Autolink, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var autolink *Autolink + resp, err := s.client.Do(ctx, req, &autolink) + if err != nil { + return nil, resp, err + } + + return autolink, resp, nil +} + +// DeleteAutolink deletes a single autolink reference by ID that was configured for the given repository. +// Information about autolinks are only available to repository administrators. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/repos#delete-an-autolink-reference-from-a-repository +func (s *RepositoriesService) DeleteAutolink(ctx context.Context, owner, repo string, id int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v37/github/repos_collaborators.go b/vendor/github.com/google/go-github/v39/github/repos_collaborators.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_collaborators.go rename to vendor/github.com/google/go-github/v39/github/repos_collaborators.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_comments.go b/vendor/github.com/google/go-github/v39/github/repos_comments.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_comments.go rename to vendor/github.com/google/go-github/v39/github/repos_comments.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_commits.go b/vendor/github.com/google/go-github/v39/github/repos_commits.go similarity index 96% rename from vendor/github.com/google/go-github/v37/github/repos_commits.go rename to vendor/github.com/google/go-github/v39/github/repos_commits.go index b49a5afeed..ce3b48e3c5 100644 --- a/vendor/github.com/google/go-github/v37/github/repos_commits.go +++ b/vendor/github.com/google/go-github/v39/github/repos_commits.go @@ -150,8 +150,12 @@ func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo strin // // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-single-commit // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-a-commit -func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string) (*RepositoryCommit, *Response, error) { +func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) (*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -224,11 +228,15 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re // CompareCommits compares a range of commits with each other. // // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#compare-two-commits -func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error) { +func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string, opts *ListOptions) (*CommitsComparison, *Response, error) { escapedBase := url.QueryEscape(base) escapedHead := url.QueryEscape(head) u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, escapedBase, escapedHead) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v37/github/repos_community_health.go b/vendor/github.com/google/go-github/v39/github/repos_community_health.go similarity index 71% rename from vendor/github.com/google/go-github/v37/github/repos_community_health.go rename to vendor/github.com/google/go-github/v39/github/repos_community_health.go index aeb4277a40..92e4d082ce 100644 --- a/vendor/github.com/google/go-github/v37/github/repos_community_health.go +++ b/vendor/github.com/google/go-github/v39/github/repos_community_health.go @@ -15,13 +15,16 @@ import ( type Metric struct { Name *string `json:"name"` Key *string `json:"key"` + SPDXID *string `json:"spdx_id"` URL *string `json:"url"` HTMLURL *string `json:"html_url"` + NodeID *string `json:"node_id"` } // CommunityHealthFiles represents the different files in the community health metrics response. type CommunityHealthFiles struct { CodeOfConduct *Metric `json:"code_of_conduct"` + CodeOfConductFile *Metric `json:"code_of_conduct_file"` Contributing *Metric `json:"contributing"` IssueTemplate *Metric `json:"issue_template"` PullRequestTemplate *Metric `json:"pull_request_template"` @@ -31,14 +34,17 @@ type CommunityHealthFiles struct { // CommunityHealthMetrics represents a response containing the community metrics of a repository. type CommunityHealthMetrics struct { - HealthPercentage *int `json:"health_percentage"` - Files *CommunityHealthFiles `json:"files"` - UpdatedAt *time.Time `json:"updated_at"` + HealthPercentage *int `json:"health_percentage"` + Description *string `json:"description"` + Documentation *string `json:"documentation"` + Files *CommunityHealthFiles `json:"files"` + UpdatedAt *time.Time `json:"updated_at"` + ContentReportsEnabled *bool `json:"content_reports_enabled"` } // GetCommunityHealthMetrics retrieves all the community health metrics for a repository. // -// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#get-community-profile-metrics +// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-community-profile-metrics func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error) { u := fmt.Sprintf("repos/%v/%v/community/profile", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -46,9 +52,6 @@ func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, own return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeRepositoryCommunityHealthMetricsPreview) - metrics := &CommunityHealthMetrics{} resp, err := s.client.Do(ctx, req, metrics) if err != nil { diff --git a/vendor/github.com/google/go-github/v37/github/repos_contents.go b/vendor/github.com/google/go-github/v39/github/repos_contents.go similarity index 97% rename from vendor/github.com/google/go-github/v37/github/repos_contents.go rename to vendor/github.com/google/go-github/v39/github/repos_contents.go index d88ae74b39..86e11c0a75 100644 --- a/vendor/github.com/google/go-github/v37/github/repos_contents.go +++ b/vendor/github.com/google/go-github/v39/github/repos_contents.go @@ -132,7 +132,7 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, for _, contents := range dirContents { if *contents.Name == filename { if contents.DownloadURL == nil || *contents.DownloadURL == "" { - return nil, resp, fmt.Errorf("No download link found for %s", filepath) + return nil, resp, fmt.Errorf("no download link found for %s", filepath) } dlResp, err := s.client.client.Get(*contents.DownloadURL) if err != nil { @@ -141,7 +141,7 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, return dlResp.Body, &Response{Response: dlResp}, nil } } - return nil, resp, fmt.Errorf("No file named %s found in %s", filename, dir) + return nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) } // DownloadContentsWithMeta is identical to DownloadContents but additionally @@ -162,7 +162,7 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne for _, contents := range dirContents { if *contents.Name == filename { if contents.DownloadURL == nil || *contents.DownloadURL == "" { - return nil, contents, resp, fmt.Errorf("No download link found for %s", filepath) + return nil, contents, resp, fmt.Errorf("no download link found for %s", filepath) } dlResp, err := s.client.client.Get(*contents.DownloadURL) if err != nil { @@ -171,7 +171,7 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne return dlResp.Body, contents, &Response{Response: dlResp}, nil } } - return nil, nil, resp, fmt.Errorf("No file named %s found in %s", filename, dir) + return nil, nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) } // GetContents can return either the metadata and content of a single file diff --git a/vendor/github.com/google/go-github/v37/github/repos_deployments.go b/vendor/github.com/google/go-github/v39/github/repos_deployments.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_deployments.go rename to vendor/github.com/google/go-github/v39/github/repos_deployments.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_environments.go b/vendor/github.com/google/go-github/v39/github/repos_environments.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_environments.go rename to vendor/github.com/google/go-github/v39/github/repos_environments.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_forks.go b/vendor/github.com/google/go-github/v39/github/repos_forks.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_forks.go rename to vendor/github.com/google/go-github/v39/github/repos_forks.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_hooks.go b/vendor/github.com/google/go-github/v39/github/repos_hooks.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_hooks.go rename to vendor/github.com/google/go-github/v39/github/repos_hooks.go diff --git a/vendor/github.com/google/go-github/v39/github/repos_hooks_deliveries.go b/vendor/github.com/google/go-github/v39/github/repos_hooks_deliveries.go new file mode 100644 index 0000000000..122674463a --- /dev/null +++ b/vendor/github.com/google/go-github/v39/github/repos_hooks_deliveries.go @@ -0,0 +1,117 @@ +// Copyright 2021 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" + "encoding/json" + "fmt" +) + +// HookDelivery represents the data that is received from GitHub's Webhook Delivery API +// +// GitHub API docs: +// - https://docs.github.com/en/rest/reference/repos#list-deliveries-for-a-repository-webhook +// - https://docs.github.com/en/rest/reference/repos#get-a-delivery-for-a-repository-webhook +type HookDelivery struct { + ID *int64 `json:"id"` + GUID *string `json:"guid"` + DeliveredAt *Timestamp `json:"delivered_at"` + Redelivery *bool `json:"redelivery"` + Duration *float64 `json:"duration"` + Status *string `json:"status"` + StatusCode *int `json:"status_code"` + Event *string `json:"event"` + Action *string `json:"action"` + InstallationID *string `json:"installation_id"` + RepositoryID *int64 `json:"repository_id"` + + // Request is populated by GetHookDelivery. + Request *HookRequest `json:"request,omitempty"` + // Response is populated by GetHookDelivery. + Response *HookResponse `json:"response,omitempty"` +} + +func (d HookDelivery) String() string { + return Stringify(d) +} + +// HookRequest is a part of HookDelivery that contains +// the HTTP headers and the JSON payload of the webhook request. +type HookRequest struct { + Headers map[string]string `json:"headers,omitempty"` + RawPayload *json.RawMessage `json:"payload,omitempty"` +} + +func (r HookRequest) String() string { + return Stringify(r) +} + +// HookResponse is a part of HookDelivery that contains +// the HTTP headers and the response body served by the webhook endpoint. +type HookResponse struct { + Headers map[string]string `json:"headers,omitempty"` + RawPayload *json.RawMessage `json:"payload,omitempty"` +} + +func (r HookResponse) String() string { + return Stringify(r) +} + +// ListHookDeliveries lists webhook deliveries for a webhook configured in a repository. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/repos#list-deliveries-for-a-repository-webhook +func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, repo string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries", owner, repo, id) + 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 + } + + deliveries := []*HookDelivery{} + resp, err := s.client.Do(ctx, req, &deliveries) + if err != nil { + return nil, resp, err + } + + return deliveries, resp, nil +} + +// GetHookDelivery returns a delivery for a webhook configured in a repository. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/repos#get-a-delivery-for-a-repository-webhook +func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v", owner, repo, hookID, deliveryID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + h := new(HookDelivery) + resp, err := s.client.Do(ctx, req, h) + if err != nil { + return nil, resp, err + } + + return h, resp, nil +} + +// ParseRequestPayload parses the request payload. For recognized event types, +// a value of the corresponding struct type will be returned. +func (d *HookDelivery) ParseRequestPayload() (interface{}, error) { + eType, ok := eventTypeMapping[*d.Event] + if !ok { + return nil, fmt.Errorf("unsupported event type %q", *d.Event) + } + + e := &Event{Type: &eType, RawPayload: d.Request.RawPayload} + return e.ParsePayload() +} diff --git a/vendor/github.com/google/go-github/v37/github/repos_invitations.go b/vendor/github.com/google/go-github/v39/github/repos_invitations.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_invitations.go rename to vendor/github.com/google/go-github/v39/github/repos_invitations.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_keys.go b/vendor/github.com/google/go-github/v39/github/repos_keys.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_keys.go rename to vendor/github.com/google/go-github/v39/github/repos_keys.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_merging.go b/vendor/github.com/google/go-github/v39/github/repos_merging.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_merging.go rename to vendor/github.com/google/go-github/v39/github/repos_merging.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_pages.go b/vendor/github.com/google/go-github/v39/github/repos_pages.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_pages.go rename to vendor/github.com/google/go-github/v39/github/repos_pages.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_prereceive_hooks.go b/vendor/github.com/google/go-github/v39/github/repos_prereceive_hooks.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_prereceive_hooks.go rename to vendor/github.com/google/go-github/v39/github/repos_prereceive_hooks.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_projects.go b/vendor/github.com/google/go-github/v39/github/repos_projects.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_projects.go rename to vendor/github.com/google/go-github/v39/github/repos_projects.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_releases.go b/vendor/github.com/google/go-github/v39/github/repos_releases.go similarity index 91% rename from vendor/github.com/google/go-github/v37/github/repos_releases.go rename to vendor/github.com/google/go-github/v39/github/repos_releases.go index f7b03f2e2a..1cd2fae669 100644 --- a/vendor/github.com/google/go-github/v37/github/repos_releases.go +++ b/vendor/github.com/google/go-github/v39/github/repos_releases.go @@ -26,6 +26,7 @@ type RepositoryRelease struct { Draft *bool `json:"draft,omitempty"` Prerelease *bool `json:"prerelease,omitempty"` DiscussionCategoryName *string `json:"discussion_category_name,omitempty"` + GenerateReleaseNotes *bool `json:"generate_release_notes,omitempty"` // The following fields are not used in CreateRelease or EditRelease: ID *int64 `json:"id,omitempty"` @@ -46,6 +47,19 @@ func (r RepositoryRelease) String() string { return Stringify(r) } +// RepositoryReleaseNotes represents a GitHub-generated release notes. +type RepositoryReleaseNotes struct { + Name string `json:"name"` + Body string `json:"body"` +} + +// GenerateNotesOptions represents the options to generate release notes. +type GenerateNotesOptions struct { + TagName string `json:"tag_name"` + PreviousTagName *string `json:"previous_tag_name,omitempty"` + TargetCommitish *string `json:"target_commitish,omitempty"` +} + // ReleaseAsset represents a GitHub release asset in a repository. type ReleaseAsset struct { ID *int64 `json:"id,omitempty"` @@ -114,6 +128,25 @@ func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, return s.getSingleRelease(ctx, u) } +// GenerateReleaseNotes generates the release notes for the given tag. +// TODO: api docs +// GitHub API docs: +func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, opts *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error) { + u := fmt.Sprintf("repos/%s/%s/releases/generate-notes", owner, repo) + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + + r := new(RepositoryReleaseNotes) + resp, err := s.client.Do(ctx, req, r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + func (s *RepositoriesService) getSingleRelease(ctx context.Context, url string) (*RepositoryRelease, *Response, error) { req, err := s.client.NewRequest("GET", url, nil) if err != nil { @@ -141,6 +174,7 @@ type repositoryReleaseRequest struct { Body *string `json:"body,omitempty"` Draft *bool `json:"draft,omitempty"` Prerelease *bool `json:"prerelease,omitempty"` + GenerateReleaseNotes *bool `json:"generate_release_notes,omitempty"` DiscussionCategoryName *string `json:"discussion_category_name,omitempty"` } @@ -161,6 +195,7 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str Draft: release.Draft, Prerelease: release.Prerelease, DiscussionCategoryName: release.DiscussionCategoryName, + GenerateReleaseNotes: release.GenerateReleaseNotes, } req, err := s.client.NewRequest("POST", u, releaseReq) @@ -193,6 +228,7 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin Draft: release.Draft, Prerelease: release.Prerelease, DiscussionCategoryName: release.DiscussionCategoryName, + GenerateReleaseNotes: release.GenerateReleaseNotes, } req, err := s.client.NewRequest("PATCH", u, releaseReq) diff --git a/vendor/github.com/google/go-github/v37/github/repos_stats.go b/vendor/github.com/google/go-github/v39/github/repos_stats.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_stats.go rename to vendor/github.com/google/go-github/v39/github/repos_stats.go diff --git a/vendor/github.com/google/go-github/v37/github/repos_statuses.go b/vendor/github.com/google/go-github/v39/github/repos_statuses.go similarity index 97% rename from vendor/github.com/google/go-github/v37/github/repos_statuses.go rename to vendor/github.com/google/go-github/v39/github/repos_statuses.go index 32929ba351..347d856ae2 100644 --- a/vendor/github.com/google/go-github/v37/github/repos_statuses.go +++ b/vendor/github.com/google/go-github/v39/github/repos_statuses.go @@ -31,6 +31,9 @@ type RepoStatus struct { // A string label to differentiate this status from the statuses of other systems. Context *string `json:"context,omitempty"` + // AvatarURL is the URL of the avatar of this status. + AvatarURL *string `json:"avatar_url,omitempty"` + Creator *User `json:"creator,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` diff --git a/vendor/github.com/google/go-github/v37/github/repos_traffic.go b/vendor/github.com/google/go-github/v39/github/repos_traffic.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/repos_traffic.go rename to vendor/github.com/google/go-github/v39/github/repos_traffic.go diff --git a/vendor/github.com/google/go-github/v39/github/scim.go b/vendor/github.com/google/go-github/v39/github/scim.go new file mode 100644 index 0000000000..7a12d85b88 --- /dev/null +++ b/vendor/github.com/google/go-github/v39/github/scim.go @@ -0,0 +1,163 @@ +// Copyright 2021 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" + "encoding/json" + "fmt" +) + +// SCIMService provides access to SCIM related functions in the +// GitHub API. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/scim +type SCIMService service + +// SCIMUserAttributes represents supported SCIM User attributes. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/scim#supported-scim-user-attributes +type SCIMUserAttributes struct { + UserName string `json:"userName"` // Configured by the admin. Could be an email, login, or username. (Required.) + Name SCIMUserName `json:"name"` // (Required.) + DisplayName *string `json:"displayName,omitempty"` // The name of the user, suitable for display to end-users. (Optional.) + Emails []*SCIMUserEmail `json:"emails"` // User emails. (Required.) + Schemas []string `json:"schemas,omitempty"` // (Optional.) + ExternalID *string `json:"externalId,omitempty"` // (Optional.) + Groups []string `json:"groups,omitempty"` // (Optional.) + Active *bool `json:"active,omitempty"` // (Optional.) +} + +// SCIMUserName represents SCIM user information. +type SCIMUserName struct { + GivenName string `json:"givenName"` // The first name of the user. (Required.) + FamilyName string `json:"familyName"` // The family name of the user. (Required.) + Formatted *string `json:"formatted,omitempty"` // (Optional.) +} + +//SCIMUserEmail represents SCIM user email. +type SCIMUserEmail struct { + Value string `json:"value"` // (Required.) + Primary *bool `json:"primary,omitempty"` // (Optional.) + Type *string `json:"type,omitempty"` // (Optional.) +} + +// ListSCIMProvisionedIdentitiesOptions represents options for ListSCIMProvisionedIdentities. +// +// Github API docs: https://docs.github.com/en/rest/reference/scim#list-scim-provisioned-identities--parameters +type ListSCIMProvisionedIdentitiesOptions struct { + StartIndex *int `json:"startIndex,omitempty"` // Used for pagination: the index of the first result to return. (Optional.) + Count *int `json:"count,omitempty"` // Used for pagination: the number of results to return. (Optional.) + // Filter results using the equals query parameter operator (eq). + // You can filter results that are equal to id, userName, emails, and external_id. + // For example, to search for an identity with the userName Octocat, you would use this query: ?filter=userName%20eq%20\"Octocat\". + // To filter results for the identity with the email octocat@github.com, you would use this query: ?filter=emails%20eq%20\"octocat@github.com\". + // (Optional.) + Filter *string `json:"filter,omitempty"` +} + +// ListSCIMProvisionedIdentities lists SCIM provisioned identities. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/scim#list-scim-provisioned-identities +func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org string, opts *ListSCIMProvisionedIdentitiesOptions) (*Response, error) { + u := fmt.Sprintf("scim/v2/organizations/%v/Users", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} + +// ProvisionAndInviteSCIMUser provisions organization membership for a user, and sends an activation email to the email address. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/scim#provision-and-invite-a-scim-user +func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string, opts *SCIMUserAttributes) (*Response, error) { + u := fmt.Sprintf("scim/v2/organizations/%v/Users", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, err + } + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} + +// GetSCIMProvisioningInfoForUser returns SCIM provisioning information for a user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/scim#get-scim-provisioning-information-for-a-user +func (s *SCIMService) GetSCIMProvisioningInfoForUser(ctx context.Context, org, scimUserID string) (*Response, error) { + u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} + +// UpdateProvisionedOrgMembership updates a provisioned organization membership. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/scim#update-a-provisioned-organization-membership +func (s *SCIMService) UpdateProvisionedOrgMembership(ctx context.Context, org, scimUserID string, opts *SCIMUserAttributes) (*Response, error) { + u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) + u, err := addOptions(u, opts) + if err != nil { + return nil, err + } + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} + +// UpdateAttributeForSCIMUserOptions represents options for UpdateAttributeForSCIMUser. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/scim#update-an-attribute-for-a-scim-user--parameters +type UpdateAttributeForSCIMUserOptions struct { + Schemas []string `json:"schemas,omitempty"` // (Optional.) + Operations UpdateAttributeForSCIMUserOperations `json:"operations"` // Set of operations to be performed. (Required.) +} + +// UpdateAttributeForSCIMUserOperations represents operations for UpdateAttributeForSCIMUser. +type UpdateAttributeForSCIMUserOperations struct { + Op string `json:"op"` // (Required.) + Path *string `json:"path,omitempty"` // (Optional.) + Value json.RawMessage `json:"value,omitempty"` // (Optional.) +} + +// UpdateAttributeForSCIMUser updates an attribute for an SCIM user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/scim#update-an-attribute-for-a-scim-user +func (s *SCIMService) UpdateAttributeForSCIMUser(ctx context.Context, org, scimUserID string, opts *UpdateAttributeForSCIMUserOptions) (*Response, error) { + u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) + u, err := addOptions(u, opts) + if err != nil { + return nil, err + } + req, err := s.client.NewRequest("PATCH", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} + +// DeleteSCIMUserFromOrg deletes SCIM user from an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/scim#delete-a-scim-user-from-an-organization +func (s *SCIMService) DeleteSCIMUserFromOrg(ctx context.Context, org, scimUserID string) (*Response, error) { + u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v37/github/search.go b/vendor/github.com/google/go-github/v39/github/search.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/search.go rename to vendor/github.com/google/go-github/v39/github/search.go diff --git a/vendor/github.com/google/go-github/v37/github/strings.go b/vendor/github.com/google/go-github/v39/github/strings.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/strings.go rename to vendor/github.com/google/go-github/v39/github/strings.go diff --git a/vendor/github.com/google/go-github/v37/github/teams.go b/vendor/github.com/google/go-github/v39/github/teams.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/teams.go rename to vendor/github.com/google/go-github/v39/github/teams.go diff --git a/vendor/github.com/google/go-github/v37/github/teams_discussion_comments.go b/vendor/github.com/google/go-github/v39/github/teams_discussion_comments.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/teams_discussion_comments.go rename to vendor/github.com/google/go-github/v39/github/teams_discussion_comments.go diff --git a/vendor/github.com/google/go-github/v37/github/teams_discussions.go b/vendor/github.com/google/go-github/v39/github/teams_discussions.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/teams_discussions.go rename to vendor/github.com/google/go-github/v39/github/teams_discussions.go diff --git a/vendor/github.com/google/go-github/v37/github/teams_members.go b/vendor/github.com/google/go-github/v39/github/teams_members.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/teams_members.go rename to vendor/github.com/google/go-github/v39/github/teams_members.go diff --git a/vendor/github.com/google/go-github/v37/github/timestamp.go b/vendor/github.com/google/go-github/v39/github/timestamp.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/timestamp.go rename to vendor/github.com/google/go-github/v39/github/timestamp.go diff --git a/vendor/github.com/google/go-github/v37/github/users.go b/vendor/github.com/google/go-github/v39/github/users.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/users.go rename to vendor/github.com/google/go-github/v39/github/users.go diff --git a/vendor/github.com/google/go-github/v37/github/users_administration.go b/vendor/github.com/google/go-github/v39/github/users_administration.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/users_administration.go rename to vendor/github.com/google/go-github/v39/github/users_administration.go diff --git a/vendor/github.com/google/go-github/v37/github/users_blocking.go b/vendor/github.com/google/go-github/v39/github/users_blocking.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/users_blocking.go rename to vendor/github.com/google/go-github/v39/github/users_blocking.go diff --git a/vendor/github.com/google/go-github/v37/github/users_emails.go b/vendor/github.com/google/go-github/v39/github/users_emails.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/users_emails.go rename to vendor/github.com/google/go-github/v39/github/users_emails.go diff --git a/vendor/github.com/google/go-github/v37/github/users_followers.go b/vendor/github.com/google/go-github/v39/github/users_followers.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/users_followers.go rename to vendor/github.com/google/go-github/v39/github/users_followers.go diff --git a/vendor/github.com/google/go-github/v37/github/users_gpg_keys.go b/vendor/github.com/google/go-github/v39/github/users_gpg_keys.go similarity index 98% rename from vendor/github.com/google/go-github/v37/github/users_gpg_keys.go rename to vendor/github.com/google/go-github/v39/github/users_gpg_keys.go index 341747891c..387cc9b038 100644 --- a/vendor/github.com/google/go-github/v37/github/users_gpg_keys.go +++ b/vendor/github.com/google/go-github/v39/github/users_gpg_keys.go @@ -18,6 +18,7 @@ type GPGKey struct { ID *int64 `json:"id,omitempty"` PrimaryKeyID *int64 `json:"primary_key_id,omitempty"` KeyID *string `json:"key_id,omitempty"` + RawKey *string `json:"raw_key,omitempty"` PublicKey *string `json:"public_key,omitempty"` Emails []*GPGEmail `json:"emails,omitempty"` Subkeys []*GPGKey `json:"subkeys,omitempty"` diff --git a/vendor/github.com/google/go-github/v37/github/users_keys.go b/vendor/github.com/google/go-github/v39/github/users_keys.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/users_keys.go rename to vendor/github.com/google/go-github/v39/github/users_keys.go diff --git a/vendor/github.com/google/go-github/v39/github/users_packages.go b/vendor/github.com/google/go-github/v39/github/users_packages.go new file mode 100644 index 0000000000..d0684406d7 --- /dev/null +++ b/vendor/github.com/google/go-github/v39/github/users_packages.go @@ -0,0 +1,207 @@ +// Copyright 2021 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" +) + +// List the packages for a user. Passing the empty string for "user" will +// list packages for the authenticated user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#list-packages-for-the-authenticated-users-namespace +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#list-packages-for-a-user +func (s *UsersService) ListPackages(ctx context.Context, user string, opts *PackageListOptions) ([]*Package, *Response, error) { + var u string + if user != "" { + u = fmt.Sprintf("user/%v/packages", user) + } else { + u = "user/packages" + } + 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 packages []*Package + resp, err := s.client.Do(ctx, req, &packages) + if err != nil { + return nil, resp, err + } + + return packages, resp, nil +} + +// Get a package by name for a user. Passing the empty string for "user" will +// get the package for the authenticated user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-for-a-user +func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packageName string) (*Package, *Response, error) { + var u string + if user != "" { + u = fmt.Sprintf("users/%v/packages/%v/%v", user, packageType, packageName) + } else { + u = fmt.Sprintf("user/packages/%v/%v", packageType, packageName) + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var pack *Package + resp, err := s.client.Do(ctx, req, &pack) + if err != nil { + return nil, resp, err + } + + return pack, resp, nil +} + +// Delete a package from a user. Passing the empty string for "user" will +// delete the package for the authenticated user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-a-package-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-a-package-for-a-user +func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) { + var u string + if user != "" { + u = fmt.Sprintf("users/%v/packages/%v/%v", user, packageType, packageName) + } else { + u = fmt.Sprintf("user/packages/%v/%v", packageType, packageName) + } + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// Restore a package to a user. Passing the empty string for "user" will +// restore the package for the authenticated user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-a-package-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-a-package-for-a-user +func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) { + var u string + if user != "" { + u = fmt.Sprintf("users/%v/packages/%v/%v/restore", user, packageType, packageName) + } else { + u = fmt.Sprintf("user/packages/%v/%v/restore", packageType, packageName) + } + + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// Get all versions of a package for a user. Passing the empty string for "user" will +// get versions for the authenticated user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-all-package-versions-for-a-package-owned-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/reference/users#delete-an-email-address-for-the-authenticated-user +func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageType, packageName string) ([]*PackageVersion, *Response, error) { + var u string + if user != "" { + u = fmt.Sprintf("users/%v/packages/%v/%v/versions", user, packageType, packageName) + } else { + u = fmt.Sprintf("user/packages/%v/%v/versions", packageType, packageName) + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var versions []*PackageVersion + resp, err := s.client.Do(ctx, req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + +// Get a specific version of a package for a user. Passing the empty string for "user" will +// get the version for the authenticated user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-version-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#get-a-package-version-for-a-user +func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { + var u string + if user != "" { + u = fmt.Sprintf("users/%v/packages/%v/%v/versions/%v", user, packageType, packageName, packageVersionID) + } else { + u = fmt.Sprintf("user/packages/%v/%v/versions/%v", packageType, packageName, packageVersionID) + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var version *PackageVersion + resp, err := s.client.Do(ctx, req, &version) + if err != nil { + return nil, resp, err + } + + return version, resp, nil +} + +// Delete a package version for a user. Passing the empty string for "user" will +// delete the version for the authenticated user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-a-package-version-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#delete-package-version-for-a-user +func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*Response, error) { + var u string + if user != "" { + u = fmt.Sprintf("users/%v/packages/%v/%v/versions/%v", user, packageType, packageName, packageVersionID) + } else { + u = fmt.Sprintf("user/packages/%v/%v/versions/%v", packageType, packageName, packageVersionID) + } + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// Restore a package version to a user. Passing the empty string for "user" will +// restore the version for the authenticated user. +// +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-a-package-version-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/en/rest/reference/packages#restore-package-version-for-a-user +func (s *UsersService) PackageRestoreVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*Response, error) { + var u string + if user != "" { + u = fmt.Sprintf("users/%v/packages/%v/%v/versions/%v/restore", user, packageType, packageName, packageVersionID) + } else { + u = fmt.Sprintf("user/packages/%v/%v/versions/%v/restore", packageType, packageName, packageVersionID) + } + + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v37/github/users_projects.go b/vendor/github.com/google/go-github/v39/github/users_projects.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/users_projects.go rename to vendor/github.com/google/go-github/v39/github/users_projects.go diff --git a/vendor/github.com/google/go-github/v37/github/with_appengine.go b/vendor/github.com/google/go-github/v39/github/with_appengine.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/with_appengine.go rename to vendor/github.com/google/go-github/v39/github/with_appengine.go diff --git a/vendor/github.com/google/go-github/v37/github/without_appengine.go b/vendor/github.com/google/go-github/v39/github/without_appengine.go similarity index 100% rename from vendor/github.com/google/go-github/v37/github/without_appengine.go rename to vendor/github.com/google/go-github/v39/github/without_appengine.go diff --git a/vendor/modules.txt b/vendor/modules.txt index f990e95de2..b8967eae2f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -455,11 +455,10 @@ github.com/golang/protobuf/ptypes/timestamp # github.com/golang/snappy v0.0.4 ## explicit github.com/golang/snappy -# github.com/google/go-github/v37 v37.0.0 +# github.com/google/go-github/v39 v39.2.0 ## explicit -github.com/google/go-github/v37/github +github.com/google/go-github/v39/github # github.com/google/go-querystring v1.1.0 -## explicit github.com/google/go-querystring/query # github.com/google/uuid v1.2.0 ## explicit