octokit 4.25.1 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/octokit/client/actions_workflow_jobs.rb +61 -0
- data/lib/octokit/client/actions_workflow_runs.rb +15 -1
- data/lib/octokit/client/actions_workflows.rb +22 -0
- data/lib/octokit/client/apps.rb +15 -15
- data/lib/octokit/client/community_profile.rb +0 -1
- data/lib/octokit/client/events.rb +0 -1
- data/lib/octokit/client/issues.rb +0 -1
- data/lib/octokit/client/licenses.rb +0 -3
- data/lib/octokit/client/oauth_applications.rb +0 -4
- data/lib/octokit/client/organizations.rb +0 -13
- data/lib/octokit/client/pages.rb +2 -4
- data/lib/octokit/client/projects.rb +25 -44
- data/lib/octokit/client/pub_sub_hubbub.rb +7 -7
- data/lib/octokit/client/reactions.rb +4 -9
- data/lib/octokit/client/repositories.rb +13 -33
- data/lib/octokit/client/reviews.rb +2 -2
- data/lib/octokit/client/search.rb +14 -1
- data/lib/octokit/client/source_import.rb +3 -8
- data/lib/octokit/client/traffic.rb +4 -8
- data/lib/octokit/client/users.rb +0 -7
- data/lib/octokit/client.rb +2 -2
- data/lib/octokit/configurable.rb +2 -4
- data/lib/octokit/connection.rb +1 -1
- data/lib/octokit/default.rb +18 -18
- data/lib/octokit/error.rb +21 -14
- data/lib/octokit/middleware/follow_redirects.rb +1 -1
- data/lib/octokit/rate_limit.rb +1 -1
- data/lib/octokit/repository.rb +1 -0
- data/lib/octokit/version.rb +3 -3
- data/octokit.gemspec +1 -1
- metadata +5 -5
- data/lib/octokit/preview.rb +0 -46
@@ -17,7 +17,6 @@ module Octokit
|
|
17
17
|
#
|
18
18
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
|
19
19
|
def commit_comment_reactions(repo, id, options = {})
|
20
|
-
options = ensure_api_media_type(:reactions, options)
|
21
20
|
get "#{Repository.path repo}/comments/#{id}/reactions", options
|
22
21
|
end
|
23
22
|
|
@@ -34,7 +33,7 @@ module Octokit
|
|
34
33
|
#
|
35
34
|
# @return [<Sawyer::Resource>] Hash representing the reaction
|
36
35
|
def create_commit_comment_reaction(repo, id, reaction, options = {})
|
37
|
-
options =
|
36
|
+
options = options.merge(content: reaction)
|
38
37
|
post "#{Repository.path repo}/comments/#{id}/reactions", options
|
39
38
|
end
|
40
39
|
|
@@ -49,7 +48,6 @@ module Octokit
|
|
49
48
|
#
|
50
49
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
|
51
50
|
def issue_reactions(repo, number, options = {})
|
52
|
-
options = ensure_api_media_type(:reactions, options)
|
53
51
|
get "#{Repository.path repo}/issues/#{number}/reactions", options
|
54
52
|
end
|
55
53
|
|
@@ -67,7 +65,7 @@ module Octokit
|
|
67
65
|
#
|
68
66
|
# @return [<Sawyer::Resource>] Hash representing the reaction.
|
69
67
|
def create_issue_reaction(repo, number, reaction, options = {})
|
70
|
-
options =
|
68
|
+
options = options.merge(content: reaction)
|
71
69
|
post "#{Repository.path repo}/issues/#{number}/reactions", options
|
72
70
|
end
|
73
71
|
|
@@ -83,7 +81,6 @@ module Octokit
|
|
83
81
|
#
|
84
82
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
|
85
83
|
def issue_comment_reactions(repo, id, options = {})
|
86
|
-
options = ensure_api_media_type(:reactions, options)
|
87
84
|
get "#{Repository.path repo}/issues/comments/#{id}/reactions", options
|
88
85
|
end
|
89
86
|
|
@@ -101,7 +98,7 @@ module Octokit
|
|
101
98
|
#
|
102
99
|
# @return [<Sawyer::Resource>] Hashes representing the reaction.
|
103
100
|
def create_issue_comment_reaction(repo, id, reaction, options = {})
|
104
|
-
options =
|
101
|
+
options = options.merge(content: reaction)
|
105
102
|
post "#{Repository.path repo}/issues/comments/#{id}/reactions", options
|
106
103
|
end
|
107
104
|
|
@@ -117,7 +114,6 @@ module Octokit
|
|
117
114
|
#
|
118
115
|
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
|
119
116
|
def pull_request_review_comment_reactions(repo, id, options = {})
|
120
|
-
options = ensure_api_media_type(:reactions, options)
|
121
117
|
get "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
|
122
118
|
end
|
123
119
|
|
@@ -135,7 +131,7 @@ module Octokit
|
|
135
131
|
#
|
136
132
|
# @return [<Sawyer::Resource>] Hash representing the reaction.
|
137
133
|
def create_pull_request_review_comment_reaction(repo, id, reaction, options = {})
|
138
|
-
options =
|
134
|
+
options = options.merge(content: reaction)
|
139
135
|
post "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
|
140
136
|
end
|
141
137
|
|
@@ -150,7 +146,6 @@ module Octokit
|
|
150
146
|
#
|
151
147
|
# @return [Boolean] Return true if reaction was deleted, false otherwise.
|
152
148
|
def delete_reaction(id, options = {})
|
153
|
-
options = ensure_api_media_type(:reactions, options)
|
154
149
|
boolean_from_response :delete, "reactions/#{id}", options
|
155
150
|
end
|
156
151
|
end
|
@@ -13,9 +13,7 @@ module Octokit
|
|
13
13
|
# @return [Boolean]
|
14
14
|
def repository?(repo, options = {})
|
15
15
|
!!repository(repo, options)
|
16
|
-
rescue Octokit::InvalidRepository
|
17
|
-
false
|
18
|
-
rescue Octokit::NotFound
|
16
|
+
rescue Octokit::InvalidRepository, Octokit::NotFound
|
19
17
|
false
|
20
18
|
end
|
21
19
|
|
@@ -47,9 +45,6 @@ module Octokit
|
|
47
45
|
# @return [Sawyer::Resource] Repository information
|
48
46
|
def edit_repository(repo, options = {})
|
49
47
|
repo = Repository.new(repo)
|
50
|
-
if options.include? :is_template
|
51
|
-
options = ensure_api_media_type(:template_repositories, options)
|
52
|
-
end
|
53
48
|
options[:name] ||= repo.name
|
54
49
|
patch "repos/#{repo}", options
|
55
50
|
end
|
@@ -160,9 +155,6 @@ module Octokit
|
|
160
155
|
opts = options.dup
|
161
156
|
organization = opts.delete :organization
|
162
157
|
opts.merge! name: name
|
163
|
-
if opts.include? :is_template
|
164
|
-
opts = ensure_api_media_type(:template_repositories, opts)
|
165
|
-
end
|
166
158
|
|
167
159
|
if organization.nil?
|
168
160
|
post 'user/repos', opts
|
@@ -195,7 +187,6 @@ module Octokit
|
|
195
187
|
# @param options [Array<Integer>] :team_ids ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.
|
196
188
|
# @return [Sawyer::Resource] Repository info for the transferred repository
|
197
189
|
def transfer_repository(repo, new_owner, options = {})
|
198
|
-
options = ensure_api_media_type(:transfer_repository, options)
|
199
190
|
post "#{Repository.path repo}/transfer", options.merge({ new_owner: new_owner })
|
200
191
|
end
|
201
192
|
alias transfer_repo transfer_repository
|
@@ -211,7 +202,6 @@ module Octokit
|
|
211
202
|
# @return [Sawyer::Resource] Repository info for the new repository
|
212
203
|
def create_repository_from_template(repo, name, options = {})
|
213
204
|
options.merge! name: name
|
214
|
-
options = ensure_api_media_type(:template_repositories, options)
|
215
205
|
post "#{Repository.path repo}/generate", options
|
216
206
|
end
|
217
207
|
alias create_repo_from_template create_repository_from_template
|
@@ -431,8 +421,7 @@ module Octokit
|
|
431
421
|
# @example List topics for octokit/octokit.rb
|
432
422
|
# client.topics('octokit/octokit.rb')
|
433
423
|
def topics(repo, options = {})
|
434
|
-
|
435
|
-
paginate "#{Repository.path repo}/topics", opts
|
424
|
+
paginate "#{Repository.path repo}/topics", options
|
436
425
|
end
|
437
426
|
|
438
427
|
# Replace all topics for a repository
|
@@ -448,8 +437,7 @@ module Octokit
|
|
448
437
|
# @example Clear all topics for octokit/octokit.rb
|
449
438
|
# client.replace_all_topics('octokit/octokit.rb', [])
|
450
439
|
def replace_all_topics(repo, names, options = {})
|
451
|
-
|
452
|
-
put "#{Repository.path repo}/topics", opts.merge(names: names)
|
440
|
+
put "#{Repository.path repo}/topics", options.merge(names: names)
|
453
441
|
end
|
454
442
|
|
455
443
|
# List contributors to a repo
|
@@ -601,10 +589,9 @@ module Octokit
|
|
601
589
|
# @example
|
602
590
|
# @client.protect_branch('octokit/octokit.rb', 'master', foo)
|
603
591
|
def protect_branch(repo, branch, options = {})
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
put "#{Repository.path repo}/branches/#{branch}/protection", opts
|
592
|
+
options[:restrictions] ||= nil
|
593
|
+
options[:required_status_checks] ||= nil
|
594
|
+
put "#{Repository.path repo}/branches/#{branch}/protection", options
|
608
595
|
end
|
609
596
|
|
610
597
|
# Get branch protection summary
|
@@ -617,12 +604,9 @@ module Octokit
|
|
617
604
|
# @example
|
618
605
|
# @client.branch_protection('octokit/octokit.rb', 'master')
|
619
606
|
def branch_protection(repo, branch, options = {})
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
rescue Octokit::BranchNotProtected
|
624
|
-
nil
|
625
|
-
end
|
607
|
+
get "#{Repository.path repo}/branches/#{branch}/protection", options
|
608
|
+
rescue Octokit::BranchNotProtected
|
609
|
+
nil
|
626
610
|
end
|
627
611
|
|
628
612
|
# Unlock a single branch from a repository
|
@@ -636,8 +620,7 @@ module Octokit
|
|
636
620
|
# @example
|
637
621
|
# @client.unprotect_branch('octokit/octokit.rb', 'master')
|
638
622
|
def unprotect_branch(repo, branch, options = {})
|
639
|
-
|
640
|
-
boolean_from_response :delete, "#{Repository.path repo}/branches/#{branch}/protection", opts
|
623
|
+
boolean_from_response :delete, "#{Repository.path repo}/branches/#{branch}/protection", options
|
641
624
|
end
|
642
625
|
|
643
626
|
# Rename a single branch from a repository
|
@@ -763,8 +746,7 @@ module Octokit
|
|
763
746
|
# @example
|
764
747
|
# @client.vulnerability_alerts_enabled?("octokit/octokit.rb")
|
765
748
|
def vulnerability_alerts_enabled?(repo, options = {})
|
766
|
-
|
767
|
-
boolean_from_response(:get, "#{Repository.path repo}/vulnerability-alerts", opts)
|
749
|
+
boolean_from_response(:get, "#{Repository.path repo}/vulnerability-alerts", options)
|
768
750
|
end
|
769
751
|
|
770
752
|
# Enable vulnerability alerts for a repository
|
@@ -777,8 +759,7 @@ module Octokit
|
|
777
759
|
# @example Enable vulnerability alerts for a repository
|
778
760
|
# @client.enable_vulnerability_alerts("octokit/octokit.rb")
|
779
761
|
def enable_vulnerability_alerts(repo, options = {})
|
780
|
-
|
781
|
-
boolean_from_response(:put, "#{Repository.path repo}/vulnerability-alerts", opts)
|
762
|
+
boolean_from_response(:put, "#{Repository.path repo}/vulnerability-alerts", options)
|
782
763
|
end
|
783
764
|
|
784
765
|
# Disable vulnerability alerts for a repository
|
@@ -791,8 +772,7 @@ module Octokit
|
|
791
772
|
# @example Disable vulnerability alerts for a repository
|
792
773
|
# @client.disable_vulnerability_alerts("octokit/octokit.rb")
|
793
774
|
def disable_vulnerability_alerts(repo, options = {})
|
794
|
-
|
795
|
-
boolean_from_response(:delete, "#{Repository.path repo}/vulnerability-alerts", opts)
|
775
|
+
boolean_from_response(:delete, "#{Repository.path repo}/vulnerability-alerts", options)
|
796
776
|
end
|
797
777
|
end
|
798
778
|
end
|
@@ -161,7 +161,7 @@ module Octokit
|
|
161
161
|
# TODO(5.0): remove deprecated behavior
|
162
162
|
if reviewers.is_a?(Array)
|
163
163
|
octokit_warn(
|
164
|
-
'Deprecated: Octokit::Client#request_pull_request_review '\
|
164
|
+
'Deprecated: Octokit::Client#request_pull_request_review ' \
|
165
165
|
"no longer takes a separate :reviewers argument.\n" \
|
166
166
|
'Please update your call to pass :reviewers and :team_reviewers as part of the options hash.'
|
167
167
|
)
|
@@ -194,7 +194,7 @@ module Octokit
|
|
194
194
|
# TODO(5.0): remove deprecated behavior
|
195
195
|
if !reviewers.empty? && !options.empty?
|
196
196
|
octokit_warn(
|
197
|
-
'Deprecated: Octokit::Client#delete_pull_request_review_request '\
|
197
|
+
'Deprecated: Octokit::Client#delete_pull_request_review_request ' \
|
198
198
|
"no longer takes a separate :reviewers argument.\n" \
|
199
199
|
'Please update your call to pass :reviewers and :team_reviewers as part of the options hash.'
|
200
200
|
)
|
@@ -31,7 +31,6 @@ module Octokit
|
|
31
31
|
# @return [Sawyer::Resource] Search results object
|
32
32
|
# @see https://developer.github.com/v3/search/#search-commits
|
33
33
|
def search_commits(query, options = {})
|
34
|
-
options = ensure_api_media_type(:commit_search, options)
|
35
34
|
search 'search/commits', query, options
|
36
35
|
end
|
37
36
|
|
@@ -64,6 +63,20 @@ module Octokit
|
|
64
63
|
end
|
65
64
|
alias search_repos search_repositories
|
66
65
|
|
66
|
+
# Search topics
|
67
|
+
#
|
68
|
+
# @param query [String] Search term and qualifiers
|
69
|
+
# @param options [Hash] Sort and pagination options
|
70
|
+
# @option options [String] :sort Sort field
|
71
|
+
# @option options [String] :order Sort order (asc or desc)
|
72
|
+
# @option options [Integer] :page Page of paginated results
|
73
|
+
# @option options [Integer] :per_page Number of items per page
|
74
|
+
# @return [Sawyer::Resource] Search results object
|
75
|
+
# @see https://developer.github.com/v3/search/#search-topics
|
76
|
+
def search_topics(query, options = {})
|
77
|
+
search 'search/topics', query, options
|
78
|
+
end
|
79
|
+
|
67
80
|
# Search users
|
68
81
|
#
|
69
82
|
# @param query [String] Search term and qualifiers
|
@@ -42,7 +42,7 @@ module Octokit
|
|
42
42
|
octokit_warn 'Octokit#start_source_import vcs parameter is now an option, please update your call before the next major Octokit version update.'
|
43
43
|
arguments.options.merge!(vcs: vcs)
|
44
44
|
end
|
45
|
-
options =
|
45
|
+
options = arguments.options.merge(vcs_url: vcs_url)
|
46
46
|
put "#{Repository.path arguments.repo}/import", options
|
47
47
|
end
|
48
48
|
|
@@ -55,7 +55,6 @@ module Octokit
|
|
55
55
|
# @example
|
56
56
|
# @client.source_import_progress("octokit/octokit.rb")
|
57
57
|
def source_import_progress(repo, options = {})
|
58
|
-
options = ensure_api_media_type(:source_imports, options)
|
59
58
|
get "#{Repository.path repo}/import", options
|
60
59
|
end
|
61
60
|
|
@@ -76,7 +75,6 @@ module Octokit
|
|
76
75
|
# :vcs_password => "secret"
|
77
76
|
# })
|
78
77
|
def update_source_import(repo, options = {})
|
79
|
-
options = ensure_api_media_type(:source_imports, options)
|
80
78
|
patch "#{Repository.path repo}/import", options
|
81
79
|
end
|
82
80
|
|
@@ -91,7 +89,6 @@ module Octokit
|
|
91
89
|
# @example
|
92
90
|
# @client.source_import_commit_authors("octokit/octokit.rb")
|
93
91
|
def source_import_commit_authors(repo, options = {})
|
94
|
-
options = ensure_api_media_type(:source_imports, options)
|
95
92
|
get "#{Repository.path repo}/import/authors", options
|
96
93
|
end
|
97
94
|
|
@@ -111,7 +108,7 @@ module Octokit
|
|
111
108
|
# :name => "Hubot the Robot"
|
112
109
|
# })
|
113
110
|
def map_source_import_commit_author(author_url, values, options = {})
|
114
|
-
options =
|
111
|
+
options = options.merge(values)
|
115
112
|
patch author_url, options
|
116
113
|
end
|
117
114
|
|
@@ -124,7 +121,6 @@ module Octokit
|
|
124
121
|
# @example
|
125
122
|
# @client.cancel_source_import("octokit/octokit.rb")
|
126
123
|
def cancel_source_import(repo, options = {})
|
127
|
-
options = ensure_api_media_type(:source_imports, options)
|
128
124
|
boolean_from_response :delete, "#{Repository.path repo}/import", options
|
129
125
|
end
|
130
126
|
|
@@ -139,7 +135,6 @@ module Octokit
|
|
139
135
|
# @example
|
140
136
|
# @client.source_import_large_files("octokit/octokit.rb")
|
141
137
|
def source_import_large_files(repo, options = {})
|
142
|
-
options = ensure_api_media_type(:source_imports, options)
|
143
138
|
get "#{Repository.path repo}/import/large_files", options
|
144
139
|
end
|
145
140
|
|
@@ -153,7 +148,7 @@ module Octokit
|
|
153
148
|
# @example
|
154
149
|
# @client.opt_in_source_import_lfs("octokit/octokit.rb", "opt_in")
|
155
150
|
def set_source_import_lfs_preference(repo, use_lfs, options = {})
|
156
|
-
options =
|
151
|
+
options = options.merge(use_lfs: use_lfs)
|
157
152
|
patch "#{Repository.path repo}/import/lfs", options
|
158
153
|
end
|
159
154
|
end
|
@@ -14,8 +14,7 @@ module Octokit
|
|
14
14
|
# @example
|
15
15
|
# @client.top_referrers('octokit/octokit.rb')
|
16
16
|
def top_referrers(repo, options = {})
|
17
|
-
|
18
|
-
get "#{Repository.path repo}/traffic/popular/referrers", opts
|
17
|
+
get "#{Repository.path repo}/traffic/popular/referrers", options
|
19
18
|
end
|
20
19
|
|
21
20
|
# Get the top 10 popular contents over the last 14 days
|
@@ -26,8 +25,7 @@ module Octokit
|
|
26
25
|
# @example
|
27
26
|
# @client.top_paths('octokit/octokit.rb')
|
28
27
|
def top_paths(repo, options = {})
|
29
|
-
|
30
|
-
get "#{Repository.path repo}/traffic/popular/paths", opts
|
28
|
+
get "#{Repository.path repo}/traffic/popular/paths", options
|
31
29
|
end
|
32
30
|
|
33
31
|
# Get the total number of views and breakdown per day or week for the
|
@@ -43,8 +41,7 @@ module Octokit
|
|
43
41
|
# @example Views per week
|
44
42
|
# @client.views('octokit/octokit.rb', per: 'week')
|
45
43
|
def views(repo, options = {})
|
46
|
-
|
47
|
-
get "#{Repository.path repo}/traffic/views", opts
|
44
|
+
get "#{Repository.path repo}/traffic/views", options
|
48
45
|
end
|
49
46
|
|
50
47
|
# Get the total number of clones and breakdown per day or week for the
|
@@ -60,8 +57,7 @@ module Octokit
|
|
60
57
|
# @example Clones per week
|
61
58
|
# @client.clones('octokit/octokit.rb', per: 'week')
|
62
59
|
def clones(repo, options = {})
|
63
|
-
|
64
|
-
get "#{Repository.path repo}/traffic/clones", opts
|
60
|
+
get "#{Repository.path repo}/traffic/clones", options
|
65
61
|
end
|
66
62
|
end
|
67
63
|
end
|
data/lib/octokit/client/users.rb
CHANGED
@@ -352,7 +352,6 @@ module Octokit
|
|
352
352
|
# @client.start_migration(['octocat/hello-world'])
|
353
353
|
# @see https://docs.github.com/en/rest/reference/migrations#start-a-user-migration
|
354
354
|
def start_user_migration(repositories, options = {})
|
355
|
-
options = ensure_api_media_type(:migrations, options)
|
356
355
|
options[:repositories] = repositories
|
357
356
|
post 'user/migrations', options
|
358
357
|
end
|
@@ -364,7 +363,6 @@ module Octokit
|
|
364
363
|
# @return [Array<Sawyer::Resource>] Array of migration resources.
|
365
364
|
# @see https://docs.github.com/en/rest/reference/migrations#list-user-migrations
|
366
365
|
def user_migrations(options = {})
|
367
|
-
options = ensure_api_media_type(:migrations, options)
|
368
366
|
paginate 'user/migrations', options
|
369
367
|
end
|
370
368
|
|
@@ -375,7 +373,6 @@ module Octokit
|
|
375
373
|
# @param id [Integer] ID number of the migration.
|
376
374
|
# @see https://docs.github.com/en/rest/reference/migrations#get-a-user-migration-status
|
377
375
|
def user_migration_status(id, options = {})
|
378
|
-
options = ensure_api_media_type(:migrations, options)
|
379
376
|
get "user/migrations/#{id}", options
|
380
377
|
end
|
381
378
|
|
@@ -386,7 +383,6 @@ module Octokit
|
|
386
383
|
# @param id [Integer] ID number of the migration.
|
387
384
|
# @see https://docs.github.com/en/rest/reference/migrations#download-a-user-migration-archive
|
388
385
|
def user_migration_archive_url(id, options = {})
|
389
|
-
options = ensure_api_media_type(:migrations, options)
|
390
386
|
url = "user/migrations/#{id}/archive"
|
391
387
|
|
392
388
|
response = client_without_redirects(options).get(url)
|
@@ -400,7 +396,6 @@ module Octokit
|
|
400
396
|
# @param id [Integer] ID number of the migration.
|
401
397
|
# @see https://docs.github.com/en/rest/reference/migrations#delete-a-user-migration-archive
|
402
398
|
def delete_user_migration_archive(id, options = {})
|
403
|
-
options = ensure_api_media_type(:migrations, options)
|
404
399
|
delete "user/migrations/#{id}/archive", options
|
405
400
|
end
|
406
401
|
|
@@ -411,7 +406,6 @@ module Octokit
|
|
411
406
|
# @param id [Integer] ID number of the migration.
|
412
407
|
# @see https://docs.github.com/en/rest/reference/migrations#list-repositories-for-a-user-migration
|
413
408
|
def user_migration_repositories(id, options = {})
|
414
|
-
options = ensure_api_media_type(:migrations, options)
|
415
409
|
get "user/migrations/#{id}/repositories", options
|
416
410
|
end
|
417
411
|
|
@@ -423,7 +417,6 @@ module Octokit
|
|
423
417
|
# @param repo [String] Name of the repository.
|
424
418
|
# @see https://docs.github.com/en/rest/reference/migrations#unlock-a-user-repository
|
425
419
|
def unlock_user_repository(id, repo, options = {})
|
426
|
-
options = ensure_api_media_type(:migrations, options)
|
427
420
|
delete "user/migrations/#{id}/repos/#{repo}/lock", options
|
428
421
|
end
|
429
422
|
end
|
data/lib/octokit/client.rb
CHANGED
@@ -11,9 +11,9 @@ require 'octokit/rate_limit'
|
|
11
11
|
require 'octokit/repository'
|
12
12
|
require 'octokit/user'
|
13
13
|
require 'octokit/organization'
|
14
|
-
require 'octokit/preview'
|
15
14
|
require 'octokit/client/actions_secrets'
|
16
15
|
require 'octokit/client/actions_workflows'
|
16
|
+
require 'octokit/client/actions_workflow_jobs'
|
17
17
|
require 'octokit/client/actions_workflow_runs'
|
18
18
|
require 'octokit/client/apps'
|
19
19
|
require 'octokit/client/authorizations'
|
@@ -73,7 +73,6 @@ module Octokit
|
|
73
73
|
include Octokit::Authentication
|
74
74
|
include Octokit::Configurable
|
75
75
|
include Octokit::Connection
|
76
|
-
include Octokit::Preview
|
77
76
|
include Octokit::Warnable
|
78
77
|
include Octokit::Client::ActionsSecrets
|
79
78
|
include Octokit::Client::Authorizations
|
@@ -93,6 +92,7 @@ module Octokit
|
|
93
92
|
include Octokit::Client::Gitignore
|
94
93
|
include Octokit::Client::Hooks
|
95
94
|
include Octokit::Client::ActionsWorkflows
|
95
|
+
include Octokit::Client::ActionsWorkflowJobs
|
96
96
|
include Octokit::Client::ActionsWorkflowRuns
|
97
97
|
include Octokit::Client::Apps
|
98
98
|
include Octokit::Client::Issues
|
data/lib/octokit/configurable.rb
CHANGED
@@ -134,9 +134,7 @@ module Octokit
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def login
|
137
|
-
@login ||=
|
138
|
-
user.login if token_authenticated?
|
139
|
-
end
|
137
|
+
@login ||= (user.login if token_authenticated?)
|
140
138
|
end
|
141
139
|
|
142
140
|
def netrc?
|
@@ -146,7 +144,7 @@ module Octokit
|
|
146
144
|
private
|
147
145
|
|
148
146
|
def options
|
149
|
-
|
147
|
+
Octokit::Configurable.keys.map { |key| [key, instance_variable_get(:"@#{key}")] }.to_h
|
150
148
|
end
|
151
149
|
|
152
150
|
def fetch_client_id_and_secret(overrides = {})
|
data/lib/octokit/connection.rb
CHANGED
@@ -201,7 +201,7 @@ module Octokit
|
|
201
201
|
end
|
202
202
|
query = options.delete(:query)
|
203
203
|
opts = { query: options }
|
204
|
-
opts[:query].merge!(query) if query
|
204
|
+
opts[:query].merge!(query) if query.is_a?(Hash)
|
205
205
|
opts[:headers] = headers unless headers.empty?
|
206
206
|
|
207
207
|
opts
|
data/lib/octokit/default.rb
CHANGED
@@ -49,55 +49,55 @@ module Octokit
|
|
49
49
|
# Configuration options
|
50
50
|
# @return [Hash]
|
51
51
|
def options
|
52
|
-
|
52
|
+
Octokit::Configurable.keys.map { |key| [key, send(key)] }.to_h
|
53
53
|
end
|
54
54
|
|
55
55
|
# Default access token from ENV
|
56
56
|
# @return [String]
|
57
57
|
def access_token
|
58
|
-
ENV
|
58
|
+
ENV.fetch('OCTOKIT_ACCESS_TOKEN', nil)
|
59
59
|
end
|
60
60
|
|
61
61
|
# Default API endpoint from ENV or {API_ENDPOINT}
|
62
62
|
# @return [String]
|
63
63
|
def api_endpoint
|
64
|
-
ENV
|
64
|
+
ENV.fetch('OCTOKIT_API_ENDPOINT') { API_ENDPOINT }
|
65
65
|
end
|
66
66
|
|
67
67
|
# Default pagination preference from ENV
|
68
68
|
# @return [String]
|
69
69
|
def auto_paginate
|
70
|
-
ENV
|
70
|
+
ENV.fetch('OCTOKIT_AUTO_PAGINATE', nil)
|
71
71
|
end
|
72
72
|
|
73
73
|
# Default bearer token from ENV
|
74
74
|
# @return [String]
|
75
75
|
def bearer_token
|
76
|
-
ENV
|
76
|
+
ENV.fetch('OCTOKIT_BEARER_TOKEN', nil)
|
77
77
|
end
|
78
78
|
|
79
79
|
# Default OAuth app key from ENV
|
80
80
|
# @return [String]
|
81
81
|
def client_id
|
82
|
-
ENV
|
82
|
+
ENV.fetch('OCTOKIT_CLIENT_ID', nil)
|
83
83
|
end
|
84
84
|
|
85
85
|
# Default OAuth app secret from ENV
|
86
86
|
# @return [String]
|
87
87
|
def client_secret
|
88
|
-
ENV
|
88
|
+
ENV.fetch('OCTOKIT_SECRET', nil)
|
89
89
|
end
|
90
90
|
|
91
91
|
# Default management console password from ENV
|
92
92
|
# @return [String]
|
93
93
|
def management_console_password
|
94
|
-
ENV
|
94
|
+
ENV.fetch('OCTOKIT_ENTERPRISE_MANAGEMENT_CONSOLE_PASSWORD', nil)
|
95
95
|
end
|
96
96
|
|
97
97
|
# Default management console endpoint from ENV
|
98
98
|
# @return [String]
|
99
99
|
def management_console_endpoint
|
100
|
-
ENV
|
100
|
+
ENV.fetch('OCTOKIT_ENTERPRISE_MANAGEMENT_CONSOLE_ENDPOINT', nil)
|
101
101
|
end
|
102
102
|
|
103
103
|
# Default options for Faraday::Connection
|
@@ -114,13 +114,13 @@ module Octokit
|
|
114
114
|
# Default media type from ENV or {MEDIA_TYPE}
|
115
115
|
# @return [String]
|
116
116
|
def default_media_type
|
117
|
-
ENV
|
117
|
+
ENV.fetch('OCTOKIT_DEFAULT_MEDIA_TYPE') { MEDIA_TYPE }
|
118
118
|
end
|
119
119
|
|
120
120
|
# Default GitHub username for Basic Auth from ENV
|
121
121
|
# @return [String]
|
122
122
|
def login
|
123
|
-
ENV
|
123
|
+
ENV.fetch('OCTOKIT_LOGIN', nil)
|
124
124
|
end
|
125
125
|
|
126
126
|
# Default middleware stack for Faraday::Connection
|
@@ -133,13 +133,13 @@ module Octokit
|
|
133
133
|
# Default GitHub password for Basic Auth from ENV
|
134
134
|
# @return [String]
|
135
135
|
def password
|
136
|
-
ENV
|
136
|
+
ENV.fetch('OCTOKIT_PASSWORD', nil)
|
137
137
|
end
|
138
138
|
|
139
139
|
# Default pagination page size from ENV
|
140
140
|
# @return [Integer] Page size
|
141
141
|
def per_page
|
142
|
-
page_size = ENV
|
142
|
+
page_size = ENV.fetch('OCTOKIT_PER_PAGE', nil)
|
143
143
|
|
144
144
|
page_size&.to_i
|
145
145
|
end
|
@@ -147,7 +147,7 @@ module Octokit
|
|
147
147
|
# Default proxy server URI for Faraday connection from ENV
|
148
148
|
# @return [String]
|
149
149
|
def proxy
|
150
|
-
ENV
|
150
|
+
ENV.fetch('OCTOKIT_PROXY', nil)
|
151
151
|
end
|
152
152
|
|
153
153
|
# Default SSL verify mode from ENV
|
@@ -162,25 +162,25 @@ module Octokit
|
|
162
162
|
# Default User-Agent header string from ENV or {USER_AGENT}
|
163
163
|
# @return [String]
|
164
164
|
def user_agent
|
165
|
-
ENV
|
165
|
+
ENV.fetch('OCTOKIT_USER_AGENT') { USER_AGENT }
|
166
166
|
end
|
167
167
|
|
168
168
|
# Default web endpoint from ENV or {WEB_ENDPOINT}
|
169
169
|
# @return [String]
|
170
170
|
def web_endpoint
|
171
|
-
ENV
|
171
|
+
ENV.fetch('OCTOKIT_WEB_ENDPOINT') { WEB_ENDPOINT }
|
172
172
|
end
|
173
173
|
|
174
174
|
# Default behavior for reading .netrc file
|
175
175
|
# @return [Boolean]
|
176
176
|
def netrc
|
177
|
-
ENV
|
177
|
+
ENV.fetch('OCTOKIT_NETRC', false)
|
178
178
|
end
|
179
179
|
|
180
180
|
# Default path for .netrc file
|
181
181
|
# @return [String]
|
182
182
|
def netrc_file
|
183
|
-
ENV
|
183
|
+
ENV.fetch('OCTOKIT_NETRC_FILE') { File.join(Dir.home.to_s, '.netrc') }
|
184
184
|
end
|
185
185
|
end
|
186
186
|
end
|