zerobounce-sdk 2.1.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +172 -19
  3. data/README.md +477 -410
  4. data/lib/zerobounce/api_key.rb +21 -0
  5. data/lib/zerobounce/api_urls.rb +9 -0
  6. data/lib/zerobounce/base_request.rb +260 -8
  7. data/lib/zerobounce/client.rb +30 -0
  8. data/lib/zerobounce/configuration.rb +24 -3
  9. data/lib/zerobounce/error.rb +20 -0
  10. data/lib/zerobounce/get_file_helper.rb +6 -8
  11. data/lib/zerobounce/priority3.rb +351 -0
  12. data/lib/zerobounce/request.rb +84 -42
  13. data/lib/zerobounce/response_error.rb +117 -0
  14. data/lib/zerobounce/validate_sub_status.rb +1 -0
  15. data/lib/zerobounce/version.rb +1 -1
  16. data/lib/zerobounce/warmup.rb +471 -0
  17. data/lib/zerobounce.rb +112 -26
  18. metadata +46 -41
  19. data/.dockerignore +0 -17
  20. data/.env.example +0 -3
  21. data/.github/auto_assign.yml +0 -5
  22. data/.github/dependabot.yml +0 -35
  23. data/.github/workflows/auto_assign_ci.yaml +0 -21
  24. data/.github/workflows/codeql.yml +0 -105
  25. data/.github/workflows/publish.yml +0 -131
  26. data/.github/workflows/sdk_ci.yml +0 -29
  27. data/.gitignore +0 -70
  28. data/.rspec +0 -2
  29. data/.ruby-version +0 -1
  30. data/CODE_OF_CONDUCT.md +0 -69
  31. data/CONTRIBUTING.md +0 -112
  32. data/Dockerfile +0 -17
  33. data/Gemfile +0 -13
  34. data/Gemfile.lock +0 -135
  35. data/LICENSE.txt +0 -21
  36. data/Rakefile +0 -26
  37. data/SECURITY.md +0 -21
  38. data/bin/bundle +0 -105
  39. data/bin/console +0 -7
  40. data/bin/setup +0 -6
  41. data/data/zerobounce-ai-scoring.csv +0 -31
  42. data/data/zerobounce-batch-validation.csv +0 -31
  43. data/documentation.md +0 -530
  44. data/files/scoring.csv +0 -1
  45. data/files/validation.csv +0 -1
  46. data/files/zerobounce-ai-scoring.csv +0 -31
  47. data/files/zerobounce-batch-validation.csv +0 -31
  48. data/lib/zerobounce/mock_request.rb +0 -86
  49. data/zerobounce.gemspec +0 -49
data/lib/zerobounce.rb CHANGED
@@ -5,6 +5,8 @@ require 'date'
5
5
  require 'tempfile'
6
6
 
7
7
  require 'zerobounce/error'
8
+ require 'zerobounce/response_error'
9
+ require 'zerobounce/client'
8
10
  require 'zerobounce/version'
9
11
  require 'zerobounce/download_type'
10
12
  require 'zerobounce/get_file_options'
@@ -12,17 +14,19 @@ require 'zerobounce/get_file_helper'
12
14
  require 'zerobounce/validate_status'
13
15
  require 'zerobounce/validate_sub_status'
14
16
  require 'zerobounce/request'
15
- require 'zerobounce/mock_request'
16
17
  require 'zerobounce/configuration'
17
18
  require 'zerobounce/api_urls'
19
+ require 'zerobounce/priority3'
20
+ require 'zerobounce/warmup'
18
21
 
19
22
  # Validate an email address with Zerobounce.net
20
23
  module Zerobounce
21
24
 
22
25
  class << self
26
+ include Priority3
23
27
  attr_writer :configuration
24
28
 
25
- @@request = ENV['TEST']=='unit' ? MockRequest : Request
29
+ @@request = Request
26
30
 
27
31
  # Zerobounce configuration
28
32
  #
@@ -52,6 +56,15 @@ module Zerobounce
52
56
  yield configuration
53
57
  end
54
58
 
59
+ # Run a block with an API key that is visible only on this thread.
60
+ def with_api_key(api_key)
61
+ previous = Thread.current[:zerobounce_api_key]
62
+ Thread.current[:zerobounce_api_key] = api_key
63
+ yield
64
+ ensure
65
+ Thread.current[:zerobounce_api_key] = previous
66
+ end
67
+
55
68
  # Validates the email address and gets geoip information for an IP if provided.
56
69
  #
57
70
  # @param [String] :email The email address to validate.
@@ -80,9 +93,47 @@ module Zerobounce
80
93
  # "zipcode": null,
81
94
  # "processed_at": "2023-04-18 12:09:39.074"
82
95
  # }
83
- def validate(email, ip_address=nil)
96
+ def validate(email, ip_address=nil, timeout: nil, activity_data: nil, verify_plus: nil,
97
+ domain_info: nil, greylist_processing: nil, callback_url: nil, use_post: false)
98
+ unless timeout.nil?
99
+ timeout_i = Integer(timeout)
100
+ if timeout_i < 3 || timeout_i > 60
101
+ raise ArgumentError, 'Invalid parameter: timeout (must be between 3 and 60 seconds)'
102
+ end
103
+ end
104
+ activity_data = __strict_bool__(activity_data, 'activity_data') unless activity_data.nil?
105
+ verify_plus = __strict_bool__(verify_plus, 'verify_plus') unless verify_plus.nil?
106
+ domain_info = __strict_bool__(domain_info, 'domain_info') unless domain_info.nil?
107
+ greylist_processing = __strict_bool__(greylist_processing, 'greylist_processing') unless greylist_processing.nil?
108
+ unless callback_url.nil?
109
+ raise ArgumentError, 'Empty parameter: callback_url' if callback_url.to_s.strip.empty?
110
+
111
+ # The callback is where the greylist retry posts its result, so it is
112
+ # meaningless - and rejected by the API - without the retry itself.
113
+ unless greylist_processing
114
+ raise ArgumentError, 'callback_url requires greylist_processing to be true'
115
+ end
116
+ end
84
117
  params = {email: email, ip_address: ip_address}
85
- @@request.get('validate', params)
118
+ params[:timeout] = timeout unless timeout.nil?
119
+ unless activity_data.nil?
120
+ params[:activity_data] = activity_data ? 'true' : 'false'
121
+ end
122
+ unless verify_plus.nil?
123
+ params[:verify_plus] = verify_plus ? 'true' : 'false'
124
+ end
125
+ unless domain_info.nil?
126
+ params[:domain_info] = domain_info ? 'true' : 'false'
127
+ end
128
+ unless greylist_processing.nil?
129
+ params[:greylist_processing] = greylist_processing ? 'true' : 'false'
130
+ end
131
+ params[:callback_url] = callback_url unless callback_url.nil?
132
+ if use_post
133
+ @@request.post('validate', params, 'application/x-www-form-urlencoded')
134
+ else
135
+ @@request.get('validate', params)
136
+ end
86
137
  end
87
138
 
88
139
  # Get the number of remaining credits on the account.
@@ -183,13 +234,33 @@ module Zerobounce
183
234
  @@request.get('activity', params)
184
235
  end
185
236
 
237
+ # Real-time AI scoring for a single email (GET /scoring by default).
238
+ #
239
+ # @param [String] :email Email to score
240
+ # @param [Boolean] :use_post When true, uses POST /scoring with form body
241
+ #
242
+ # @return [Hash] e.g. {"email"=>"mark@gmail.com", "score"=>10}
243
+ def score_email(email, use_post: false)
244
+ params = { email: email }
245
+ if use_post
246
+ @@request.post('scoring', params, 'application/x-www-form-urlencoded')
247
+ else
248
+ @@request.get('scoring', params)
249
+ end
250
+ end
251
+
186
252
  # Validate email batch
187
253
  #
188
254
  # @param [Array] :emails List of email addresses to validate.
189
255
  # @option [Array] :ip_addresses Corresponding list of IP addresses.
190
256
  #
191
- # @return [Array] list of validate result for each element
192
- # [
257
+ # @return [Hash] the whole response: +email_batch+ holds one validate
258
+ # result per address, +errors+ the addresses that could not be
259
+ # validated. A per-address error does not raise; an account-level one
260
+ # (reported for the address "all", e.g. an invalid key) does.
261
+ # Up to 2.1.8 this returned only the +email_batch+ Array.
262
+ # {
263
+ # "email_batch": [
193
264
  # {
194
265
  # "address": "disposable@example.com",
195
266
  # "status": "do_not_mail",
@@ -216,8 +287,16 @@ module Zerobounce
216
287
  # ...
217
288
  # },
218
289
  # ...
219
- # ]
220
- def validate_batch(emails, ip_addresses=[])
290
+ # ],
291
+ # "errors": []
292
+ # }
293
+ def validate_batch(emails, ip_addresses=[], timeout: nil, activity_data: nil, verify_plus: nil)
294
+ unless timeout.nil?
295
+ timeout_i = Integer(timeout)
296
+ if timeout_i < 10 || timeout_i > 120
297
+ raise ArgumentError, 'Invalid parameter: timeout (must be between 10 and 120 seconds)'
298
+ end
299
+ end
221
300
 
222
301
  raise ArgumentError.new if emails.class != Array
223
302
  emails.each do |email|
@@ -232,8 +311,14 @@ module Zerobounce
232
311
  })
233
312
  end
234
313
  params = {email_batch: email_batch}
314
+ # LIVE: validatebatch takes timeout as a JSON *string*. Sent as a number
315
+ # the API rejects the whole batch with the account-level "Invalid API Key
316
+ # or your account ran out of credits".
317
+ params[:timeout] = timeout.to_s unless timeout.nil?
318
+ params[:activity_data] = __strict_bool__(activity_data, 'activity_data') unless activity_data.nil?
319
+ params[:verify_plus] = __strict_bool__(verify_plus, 'verify_plus') unless verify_plus.nil?
235
320
  results = @@request.post('validatebatch', params)
236
- return results['email_batch']
321
+ results
237
322
  end
238
323
 
239
324
  # Validate CSV file
@@ -263,16 +348,14 @@ module Zerobounce
263
348
  return_url: nil,
264
349
  allow_phase_2: nil
265
350
  )
266
- params = {
267
- email_address_column: email_address_column,
268
- has_header_row: has_header_row,
269
- }
270
- params[:first_name_column] = first_name_column if first_name_column
271
- params[:last_name_column] = last_name_column if last_name_column
272
- params[:gender_column] = gender_column if gender_column
273
- params[:return_url] = return_url if return_url
351
+ params = { email_address_column: email_address_column }
352
+ params[:has_header_row] = __wire_bool__(has_header_row, 'has_header_row') unless has_header_row.nil?
353
+ params[:first_name_column] = first_name_column unless first_name_column.nil?
354
+ params[:last_name_column] = last_name_column unless last_name_column.nil?
355
+ params[:gender_column] = gender_column unless gender_column.nil?
356
+ params[:return_url] = return_url unless return_url.nil? || return_url.to_s.empty?
274
357
  unless allow_phase_2.nil?
275
- params[:allow_phase_2] = allow_phase_2 ? 'true' : 'false'
358
+ params[:allow_phase_2] = __wire_bool__(allow_phase_2, 'allow_phase_2')
276
359
  end
277
360
  @@request.bulk_post('sendfile', params, 'multipart/form-data', filepath)
278
361
  end
@@ -332,7 +415,7 @@ module Zerobounce
332
415
  if options
333
416
  params[:download_type] = options.download_type if options.download_type
334
417
  unless options.activity_data.nil?
335
- params[:activity_data] = options.activity_data ? 'true' : 'false'
418
+ params[:activity_data] = __wire_bool__(options.activity_data, 'activity_data')
336
419
  end
337
420
  end
338
421
  @@request.bulk_getfile('getfile', params)
@@ -375,10 +458,8 @@ module Zerobounce
375
458
  has_header_row: true,
376
459
  return_url: nil
377
460
  )
378
- params = {
379
- email_address_column: email_address_column,
380
- has_header_row: has_header_row,
381
- }
461
+ params = { email_address_column: email_address_column }
462
+ params[:has_header_row] = __wire_bool__(has_header_row, 'has_header_row') unless has_header_row.nil?
382
463
  params[:return_url] = return_url if return_url
383
464
  @@request.bulk_post('scoring/sendfile', params, 'multipart/form-data', filepath)
384
465
  end
@@ -513,7 +594,8 @@ module Zerobounce
513
594
  #
514
595
  # @option [String] domain Domain to search within (e.g. example.com). Required if company_name is not provided.
515
596
  # @option [String] company_name Company name to search within (e.g. Example). Required if domain is not provided.
516
- # @option [String] first_name First name of target.
597
+ # @param [String] first_name First name of target. Optional: left out, the
598
+ # call answers with the domain's format rather than one person's address.
517
599
  # @option [String] middle_name Middle name of target.
518
600
  # @option [String] last_name Last name of target.
519
601
  #
@@ -526,7 +608,10 @@ module Zerobounce
526
608
  # "did_you_mean": "",
527
609
  # "failure_reason": ""
528
610
  # }
529
- def find_email(first_name, domain: '', company_name: '', middle_name: '', last_name: '')
611
+ # first_name is optional: /guessformat only requires a domain or a company
612
+ # name, and answers the domain's format when no name is given. It stays the
613
+ # first positional argument, so every existing call keeps working.
614
+ def find_email(first_name = nil, domain: '', company_name: '', middle_name: '', last_name: '')
530
615
  # Validate that exactly one of domain or company_name is provided
531
616
  if (domain.nil? || domain.empty?) && (company_name.nil? || company_name.empty?)
532
617
  raise ArgumentError, "Either domain or company_name must be provided"
@@ -534,7 +619,8 @@ module Zerobounce
534
619
  raise ArgumentError, "Only one of domain or company_name can be provided"
535
620
  end
536
621
 
537
- params = { first_name: first_name }
622
+ params = {}
623
+ params[:first_name] = first_name unless first_name.nil? || first_name.to_s.empty?
538
624
  params[:domain] = domain unless domain.nil? || domain.empty?
539
625
  params[:company_name] = company_name unless company_name.nil? || company_name.empty?
540
626
  params[:middle_name] = middle_name unless middle_name.nil? || middle_name.empty?
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zerobounce-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zero Bounce
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-08-14 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rest-client
@@ -31,7 +30,7 @@ dependencies:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
32
  version: '0'
34
- type: :runtime
33
+ type: :development
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
@@ -94,6 +93,34 @@ dependencies:
94
93
  - - ">="
95
94
  - !ruby/object:Gem::Version
96
95
  version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: racc
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: benchmark
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
97
124
  - !ruby/object:Gem::Dependency
98
125
  name: bundler
99
126
  requirement: !ruby/object:Gem::Requirement
@@ -282,65 +309,43 @@ dependencies:
282
309
  - - "~>"
283
310
  - !ruby/object:Gem::Version
284
311
  version: '6.4'
285
- description: A Ruby client for Zerobounce.net.
312
+ description: 'The official Ruby client for the ZeroBounce API: real-time and batch
313
+ email validation, AI scoring, bulk file validation and scoring, email finder and
314
+ domain search, the list evaluator, filters, the Inbox Placement Tester and Warmup.'
286
315
  email:
287
316
  - integrations@zerobounce.net
288
317
  executables: []
289
318
  extensions: []
290
319
  extra_rdoc_files: []
291
320
  files:
292
- - ".dockerignore"
293
- - ".env.example"
294
- - ".github/auto_assign.yml"
295
- - ".github/dependabot.yml"
296
- - ".github/workflows/auto_assign_ci.yaml"
297
- - ".github/workflows/codeql.yml"
298
- - ".github/workflows/publish.yml"
299
- - ".github/workflows/sdk_ci.yml"
300
- - ".gitignore"
301
- - ".rspec"
302
- - ".ruby-version"
303
321
  - CHANGELOG.md
304
- - CODE_OF_CONDUCT.md
305
- - CONTRIBUTING.md
306
- - Dockerfile
307
- - Gemfile
308
- - Gemfile.lock
309
322
  - LICENSE
310
- - LICENSE.txt
311
323
  - README.md
312
- - Rakefile
313
- - SECURITY.md
314
- - bin/bundle
315
- - bin/console
316
- - bin/setup
317
- - data/zerobounce-ai-scoring.csv
318
- - data/zerobounce-batch-validation.csv
319
- - documentation.md
320
- - files/scoring.csv
321
- - files/validation.csv
322
- - files/zerobounce-ai-scoring.csv
323
- - files/zerobounce-batch-validation.csv
324
324
  - lib/zerobounce.rb
325
+ - lib/zerobounce/api_key.rb
325
326
  - lib/zerobounce/api_urls.rb
326
327
  - lib/zerobounce/base_request.rb
328
+ - lib/zerobounce/client.rb
327
329
  - lib/zerobounce/configuration.rb
328
330
  - lib/zerobounce/download_type.rb
329
331
  - lib/zerobounce/error.rb
330
332
  - lib/zerobounce/get_file_helper.rb
331
333
  - lib/zerobounce/get_file_options.rb
332
- - lib/zerobounce/mock_request.rb
334
+ - lib/zerobounce/priority3.rb
333
335
  - lib/zerobounce/request.rb
336
+ - lib/zerobounce/response_error.rb
334
337
  - lib/zerobounce/validate_status.rb
335
338
  - lib/zerobounce/validate_sub_status.rb
336
339
  - lib/zerobounce/version.rb
337
- - zerobounce.gemspec
340
+ - lib/zerobounce/warmup.rb
338
341
  homepage: https://zerobounce.net
339
342
  licenses:
340
343
  - MIT
341
344
  metadata:
342
345
  yard.run: yri
343
- post_install_message:
346
+ homepage_uri: https://zerobounce.net
347
+ source_code_uri: https://github.com/zerobounce/zero-bounce-ruby
348
+ changelog_uri: https://github.com/zerobounce/zero-bounce-ruby/blob/develop/CHANGELOG.md
344
349
  rdoc_options: []
345
350
  require_paths:
346
351
  - lib
@@ -348,15 +353,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
348
353
  requirements:
349
354
  - - ">="
350
355
  - !ruby/object:Gem::Version
351
- version: '2.5'
356
+ version: '3.0'
352
357
  required_rubygems_version: !ruby/object:Gem::Requirement
353
358
  requirements:
354
359
  - - ">="
355
360
  - !ruby/object:Gem::Version
356
361
  version: '0'
357
362
  requirements: []
358
- rubygems_version: 3.4.19
359
- signing_key:
363
+ rubygems_version: 3.6.9
360
364
  specification_version: 4
361
- summary: A Ruby client for Zerobounce.net.
365
+ summary: 'Official ZeroBounce Ruby SDK: email validation, AI scoring, bulk files,
366
+ email finder and domain search'
362
367
  test_files: []
data/.dockerignore DELETED
@@ -1,17 +0,0 @@
1
- # Keep .git so gemspec `git ls-files` works during `bundle install` in the image.
2
-
3
- # Docs and tooling not needed to run specs in the image
4
- *.md
5
- documentation*.md
6
- .spec
7
- .rspec_status
8
- coverage/
9
- tmp/
10
- pkg/
11
- vendor/bundle
12
-
13
- # OS & env
14
- .DS_Store
15
- Thumbs.db
16
- .env
17
- .env.*
data/.env.example DELETED
@@ -1,3 +0,0 @@
1
- # ZeroBounce API key (standard). Get your key at https://www.zerobounce.net/docs/api-dashboard
2
- # Copy this file to .env and set your key.
3
- ZEROBOUNCE_API_KEY=your_api_key_here
@@ -1,5 +0,0 @@
1
- addReviewers: false
2
- addAssignees: true
3
- assignees:
4
- - franciscbalint
5
- numberOfAssignees: 1
@@ -1,35 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#versioning-strategy
4
-
5
- version: 2
6
- updates:
7
- # Keep the Ruby dependencies up to date
8
- - package-ecosystem: "bundler"
9
- directory: "/"
10
- schedule:
11
- interval: "weekly"
12
- day: "monday"
13
- target-branch: "develop"
14
- labels:
15
- - "ruby dependencies"
16
- groups:
17
- bundler:
18
- applies-to: version-updates
19
- patterns:
20
- - "*"
21
-
22
- # Keep the Github Actions dependencies up to date
23
- - package-ecosystem: "github-actions"
24
- directory: "/"
25
- schedule:
26
- interval: "weekly"
27
- day: "monday"
28
- target-branch: "develop"
29
- labels:
30
- - "github dependencies"
31
- groups:
32
- github:
33
- applies-to: version-updates
34
- patterns:
35
- - "*"
@@ -1,21 +0,0 @@
1
- name: Auto Assign
2
-
3
- on:
4
- pull_request_target:
5
- types:
6
- - opened
7
- - synchronize
8
- - reopened
9
-
10
- permissions:
11
- contents: read
12
- pull-requests: write
13
-
14
- jobs:
15
- add-assignee:
16
- name: Auto assign (me only)
17
- runs-on: ubuntu-latest
18
- steps:
19
- - uses: kentaro-m/auto-assign-action@v2.0.2
20
- with:
21
- configuration-path: ".github/auto_assign.yml"
@@ -1,105 +0,0 @@
1
- # For most projects, this workflow file will not need changing; you simply need
2
- # to commit it to your repository.
3
- #
4
- # You may wish to alter this file to override the set of languages analyzed,
5
- # or to provide custom queries or build logic.
6
- #
7
- # ******** NOTE ********
8
- # We have attempted to detect the languages in your repository. Please check
9
- # the `language` matrix defined below to confirm you have the correct set of
10
- # supported CodeQL languages.
11
- #
12
- name: "CodeQL Advanced"
13
-
14
- on:
15
- push:
16
- branches: [ "develop" ]
17
- pull_request:
18
- branches: [ "develop" ]
19
- schedule:
20
- - cron: '19 14 * * 4'
21
-
22
- permissions:
23
- security-events: write
24
- packages: read
25
- actions: read
26
- contents: read
27
-
28
- jobs:
29
- analyze:
30
- name: Analyze (${{ matrix.language }})
31
- # Runner size impacts CodeQL analysis time. To learn more, please see:
32
- # - https://gh.io/recommended-hardware-resources-for-running-codeql
33
- # - https://gh.io/supported-runners-and-hardware-resources
34
- # - https://gh.io/using-larger-runners (GitHub.com only)
35
- # Consider using larger runners or machines with greater resources for possible analysis time improvements.
36
- runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
37
- permissions:
38
- # required for all workflows
39
- security-events: write
40
-
41
- # required to fetch internal or private CodeQL packs
42
- packages: read
43
-
44
- # only required for workflows in private repositories
45
- actions: read
46
- contents: read
47
-
48
- strategy:
49
- fail-fast: false
50
- matrix:
51
- include:
52
- - language: ruby
53
- build-mode: none
54
- # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
55
- # Use `c-cpp` to analyze code written in C, C++ or both
56
- # Use 'java-kotlin' to analyze code written in Java, Kotlin or both
57
- # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
58
- # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
59
- # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
60
- # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
61
- # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
62
- steps:
63
- - name: Checkout repository
64
- uses: actions/checkout@v7
65
-
66
- # Add any setup steps before running the `github/codeql-action/init` action.
67
- # This includes steps like installing compilers or runtimes (`actions/setup-node`
68
- # or others). This is typically only required for manual builds.
69
- # - name: Setup runtime (example)
70
- # uses: actions/setup-example@v1
71
-
72
- # Initializes the CodeQL tools for scanning.
73
- - name: Initialize CodeQL
74
- uses: github/codeql-action/init@v4.36.3
75
- with:
76
- languages: ${{ matrix.language }}
77
- build-mode: ${{ matrix.build-mode }}
78
- # If you wish to specify custom queries, you can do so here or in a config file.
79
- # By default, queries listed here will override any specified in a config file.
80
- # Prefix the list here with "+" to use these queries and those in the config file.
81
-
82
- # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
83
- # queries: security-extended,security-and-quality
84
-
85
- # If the analyze step fails for one of the languages you are analyzing with
86
- # "We were unable to automatically build your code", modify the matrix above
87
- # to set the build mode to "manual" for that language. Then modify this step
88
- # to build your code.
89
- # ℹ️ Command-line programs to run using the OS shell.
90
- # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
91
- - name: Run manual build steps
92
- if: matrix.build-mode == 'manual'
93
- shell: bash
94
- run: |
95
- echo 'If you are using a "manual" build mode for one or more of the' \
96
- 'languages you are analyzing, replace this with the commands to build' \
97
- 'your code, for example:'
98
- echo ' make bootstrap'
99
- echo ' make release'
100
- exit 1
101
-
102
- - name: Perform CodeQL Analysis
103
- uses: github/codeql-action/analyze@v4.36.3
104
- with:
105
- category: "/language:${{matrix.language}}"