module Octokit::Client::DependabotSecrets

Methods for the dependabot Secrets API

@see docs.github.com/en/rest/dependabot/

Public Instance Methods

create_or_update_dependabot_secret(repo, name, options) click to toggle source

Create or update secrets

@param repo [Integer, String, Hash, Repository] A GitHub repository @param name [String] Name of secret @param options [Hash] encrypted_value and key_id @see docs.github.com/en/rest/dependabot/repository-secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret

# File lib/octokit/client/dependabot_secrets.rb, line 75
def create_or_update_dependabot_secret(repo, name, options)
  put "#{Repository.path repo}/dependabot/secrets/#{name}", options
end
create_or_update_org_dependabot_secret(org, name, options) click to toggle source

Create or update org secrets

@param org [String] A GitHub organization @param name [String] Name of secret @param options [Hash] encrypted_value and key_id @see docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret

# File lib/octokit/client/dependabot_secrets.rb, line 85
def create_or_update_org_dependabot_secret(org, name, options)
  put "#{Organization.path org}/dependabot/secrets/#{name}", options
end
delete_dependabot_secret(repo, name) click to toggle source

Delete a secret

@param repo [Integer, String, Hash, Repository] A GitHub repository @param name [String] Name of secret @see docs.github.com/en/rest/dependabot/repository-secrets?apiVersion=2022-11-28#delete-a-repository-secret

# File lib/octokit/client/dependabot_secrets.rb, line 94
def delete_dependabot_secret(repo, name)
  boolean_from_response :delete, "#{Repository.path repo}/dependabot/secrets/#{name}"
end
delete_org_dependabot_secret(org, name) click to toggle source

Delete an org secret

@param org [String] A GitHub organization @param name [String] Name of secret @see docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#delete-an-organization-secret

# File lib/octokit/client/dependabot_secrets.rb, line 103
def delete_org_dependabot_secret(org, name)
  boolean_from_response :delete, "#{Organization.path org}/dependabot/secrets/#{name}"
end
get_dependabot_public_key(repo) click to toggle source

Get public key for secrets encryption

@param repo [Integer, String, Hash, Repository] A GitHub repository @return [Hash] key_id and key @see docs.github.com/en/rest/dependabot/repository-secrets#get-a-repository-public-key

# File lib/octokit/client/dependabot_secrets.rb, line 14
def get_dependabot_public_key(repo)
  get "#{Repository.path repo}/dependabot/secrets/public-key"
end
get_dependabot_secret(repo, name) click to toggle source

Get a secret

@param repo [Integer, String, Hash, Repository] A GitHub repository @param name [String] Name of secret @return [Hash] name, created_at, updated_at, and visibility @see docs.github.com/en/rest/dependabot/repository-secrets?apiVersion=2022-11-28#get-a-repository-secret

# File lib/octokit/client/dependabot_secrets.rb, line 55
def get_dependabot_secret(repo, name)
  get "#{Repository.path repo}/dependabot/secrets/#{name}"
end
get_org_dependabot_public_key(org) click to toggle source

Get public key for secrets encryption

@param org [String] A GitHub organization @return [Hash] key_id and key @see docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#get-an-organization-public-key

# File lib/octokit/client/dependabot_secrets.rb, line 23
def get_org_dependabot_public_key(org)
  get "#{Organization.path org}/dependabot/secrets/public-key"
end
get_org_dependabot_secret(org, name) click to toggle source

Get an org secret

@param org [String] A GitHub organization @param name [String] Name of secret @return [Hash] name, created_at, updated_at, and visibility @see docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#get-an-organization-secret

# File lib/octokit/client/dependabot_secrets.rb, line 65
def get_org_dependabot_secret(org, name)
  get "#{Organization.path org}/dependabot/secrets/#{name}"
end
list_dependabot_secrets(repo) click to toggle source

List secrets

@param repo [Integer, String, Hash, Repository] A GitHub repository @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at) @see docs.github.com/en/rest/dependabot/repository-secrets?apiVersion=2022-11-28#list-repository-secrets

# File lib/octokit/client/dependabot_secrets.rb, line 32
def list_dependabot_secrets(repo)
  paginate "#{Repository.path repo}/dependabot/secrets" do |data, last_response|
    data.secrets.concat last_response.data.secrets
  end
end
list_org_dependabot_secrets(org) click to toggle source

List org secrets

@param org [String] A GitHub organization @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at) @see docs.github.com/en/rest/dependabot/organization-secrets?apiVersion=2022-11-28#list-organization-secrets

# File lib/octokit/client/dependabot_secrets.rb, line 43
def list_org_dependabot_secrets(org)
  paginate "#{Organization.path org}/dependabot/secrets" do |data, last_response|
    data.secrets.concat last_response.data.secrets
  end
end