Class: VectorAmp::GitHubSource
- Defined in:
- lib/vector_amp/source.rb
Overview
GitHub ingestion source backed by the VectorAmp GitHub App.
Repositories, active branches, pull requests, and review discussions are read through a GitHub App installation, so no token is passed to the SDK. Install the VectorAmp GitHub App from the Sources page in the app first; the installation id shown there is what this class needs.
Constant Summary
Constants inherited from Source
Source::SUPPORTED_SOURCE_TYPES
Instance Attribute Summary
Attributes inherited from Source
#config, #description, #id, #metadata, #name, #source_type
Instance Method Summary collapse
Methods inherited from Source
#[], from_api, #inspect, normalize_hash, #to_create_body, #to_h
Constructor Details
#initialize(installation_id:, repositories:, name: nil, ref_mode: nil, refs: nil, excluded_refs: nil, active_branch_days: nil, include_pull_requests: nil, include_review_threads: nil, include_direct_commits: nil, include_globs: nil, exclude_globs: nil, max_file_size_bytes: nil, description: nil, metadata: nil, id: nil, **config) ⇒ GitHubSource
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/vector_amp/source.rb', line 410 def initialize(installation_id:, repositories:, name: nil, ref_mode: nil, refs: nil, excluded_refs: nil, active_branch_days: nil, include_pull_requests: nil, include_review_threads: nil, include_direct_commits: nil, include_globs: nil, exclude_globs: nil, max_file_size_bytes: nil, description: nil, metadata: nil, id: nil, **config) unless installation_id.is_a?(Integer) && installation_id.positive? raise ArgumentError, "installation_id must be a positive Integer" end repository_list = Array(repositories) raise ArgumentError, "repositories must not be empty" if repository_list.empty? super( id: id, source_type: "github", name: name || SourceNames.github(repositories: repository_list), description: description, metadata: , config: Utils.compact_hash(config.merge( installation_id: installation_id, repositories: repository_list, ref_mode: ref_mode, refs: refs.nil? ? nil : Array(refs), excluded_refs: excluded_refs.nil? ? nil : Array(excluded_refs), active_branch_days: active_branch_days, include_pull_requests: include_pull_requests, include_review_threads: include_review_threads, include_direct_commits: include_direct_commits, include_globs: include_globs.nil? ? nil : Array(include_globs), exclude_globs: exclude_globs.nil? ? nil : Array(exclude_globs), max_file_size_bytes: max_file_size_bytes )) ) end |