Sha256: f7c7165854442d4caa8dbe0828eae3e3d8326a848ad1bdb8a03bf753c46f8d4a

Contents?: true

Size: 843 Bytes

Versions: 2

Compression:

Stored size: 843 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'github_authentication'

begin
  require 'active_support/cache'
  require 'active_support/notifications'
rescue LoadError
  warn("Active Support is required for the credential helper")
  exit(2)
end

case ARGV[0]
when 'get'
  exit_status = GithubAuthentication::GitCredentialHelper.new(
    pem: File.read(ENV.fetch('GITHUB_APP_KEYFILE')),
    app_id: ENV.fetch('GITHUB_APP_ID'),
    installation_id: ENV.fetch('GITHUB_APP_INSTALLATION_ID'),
    storage: ActiveSupport::Cache::FileStore.new(ENV.fetch('GITHUB_APP_CREDENTIAL_STORAGE_PATH'))
  ).handle_get
  exit(exit_status)
when 'store'
  # We maintain our own internal storage, so no-op any `store` requests
when nil, ''
  warn('Supported operations: get, store')
  exit(1)
else
  warn("Unknown argument: #{ARGV[0]}")
  exit(1)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
github-authentication-1.0.1 exe/git-credential-github-app
github-authentication-1.0.0 exe/git-credential-github-app