Module: Octokit::Client::ActionsSecrets

Included in:
Octokit::Client
Defined in:
lib/octokit/client/actions_secrets.rb

Overview

Methods for the Actions Secrets API

Instance Method Summary collapse

Instance Method Details

#create_or_update_actions_environment_secret(repo, environment, name, options) ⇒ Object

Create or update an environment secret

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • environment (String)

    Name of environment

  • name (String)

    Name of secret

  • options (Hash)

    encrypted_value and key_id

See Also:



147
148
149
# File 'lib/octokit/client/actions_secrets.rb', line 147

def create_or_update_actions_environment_secret(repo, environment, name, options)
  put "#{Repository.path repo}/environments/#{environment}/secrets/#{name}", options
end

#create_or_update_actions_secret(repo, name, options) ⇒ Object

Create or update secrets

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • name (String)

    Name of secret

  • options (Hash)

    encrypted_value and key_id

See Also:



75
76
77
# File 'lib/octokit/client/actions_secrets.rb', line 75

def create_or_update_actions_secret(repo, name, options)
  put "#{Repository.path repo}/actions/secrets/#{name}", options
end

#create_or_update_org_actions_secret(org, name, options) ⇒ Object

Create or update org secrets

Parameters:

  • org (String)

    A GitHub organization

  • name (String)

    Name of secret

  • options (Hash)

    encrypted_value and key_id

See Also:



85
86
87
# File 'lib/octokit/client/actions_secrets.rb', line 85

def create_or_update_org_actions_secret(org, name, options)
  put "#{Organization.path org}/actions/secrets/#{name}", options
end

#delete_actions_environment_secret(repo, environment, name) ⇒ Object

Delete environment secret

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • environment (String)

    Name of environment

  • name (String)

    Name of secret

See Also:



156
157
158
# File 'lib/octokit/client/actions_secrets.rb', line 156

def delete_actions_environment_secret(repo, environment, name)
  boolean_from_response :delete, "#{Repository.path repo}/environments/#{environment}/secrets/#{name}"
end

#delete_actions_secret(repo, name) ⇒ Object

Delete a secret

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • name (String)

    Name of secret

See Also:



94
95
96
# File 'lib/octokit/client/actions_secrets.rb', line 94

def delete_actions_secret(repo, name)
  boolean_from_response :delete, "#{Repository.path repo}/actions/secrets/#{name}"
end

#delete_org_actions_secret(org, name) ⇒ Object

Delete an org secret

Parameters:

  • org (String)

    A GitHub organization

  • name (String)

    Name of secret

See Also:



103
104
105
# File 'lib/octokit/client/actions_secrets.rb', line 103

def delete_org_actions_secret(org, name)
  boolean_from_response :delete, "#{Organization.path org}/actions/secrets/#{name}"
end

#get_actions_environment_public_key(repo, environment) ⇒ Hash

Get environment public key for secrets encryption

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • environment (String)

    Name of environment

Returns:

  • (Hash)

    key_id and key

See Also:



113
114
115
# File 'lib/octokit/client/actions_secrets.rb', line 113

def get_actions_environment_public_key(repo, environment)
  get "#{Repository.path repo}/environments/#{environment}/secrets/public-key"
end

#get_actions_environment_secret(repo, environment, name) ⇒ Hash

Get an environment secret

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • environment (String)

    Name of environment

  • name (String)

    Name of secret

Returns:

  • (Hash)

    name, created_at and updated_at

See Also:



136
137
138
# File 'lib/octokit/client/actions_secrets.rb', line 136

def get_actions_environment_secret(repo, environment, name)
  get "#{Repository.path repo}/environments/#{environment}/secrets/#{name}"
end

#get_actions_public_key(repo) ⇒ Hash

Get public key for secrets encryption

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

Returns:

  • (Hash)

    key_id and key

See Also:



14
15
16
# File 'lib/octokit/client/actions_secrets.rb', line 14

def get_actions_public_key(repo)
  get "#{Repository.path repo}/actions/secrets/public-key"
end

#get_actions_secret(repo, name) ⇒ Hash

Get a secret

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • name (String)

    Name of secret

Returns:

  • (Hash)

    name, created_at and updated_at

See Also:



55
56
57
# File 'lib/octokit/client/actions_secrets.rb', line 55

def get_actions_secret(repo, name)
  get "#{Repository.path repo}/actions/secrets/#{name}"
end

#get_org_actions_public_key(org) ⇒ Hash

Get public key for secrets encryption

Parameters:

  • org (String)

    A GitHub organization

Returns:

  • (Hash)

    key_id and key

See Also:



23
24
25
# File 'lib/octokit/client/actions_secrets.rb', line 23

def get_org_actions_public_key(org)
  get "#{Organization.path org}/actions/secrets/public-key"
end

#get_org_actions_secret(org, name) ⇒ Hash

Get an org secret

Parameters:

  • org (String)

    A GitHub organization

  • name (String)

    Name of secret

Returns:

  • (Hash)

    name, created_at and updated_at

See Also:



65
66
67
# File 'lib/octokit/client/actions_secrets.rb', line 65

def get_org_actions_secret(org, name)
  get "#{Organization.path org}/actions/secrets/#{name}"
end

#list_actions_environment_secrets(repo, environment) ⇒ Hash

List environment secrets

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • environment (String)

    Name of environment

Returns:

  • (Hash)

    total_count and list of secrets (each item is hash with name, created_at and updated_at)

See Also:



123
124
125
126
127
# File 'lib/octokit/client/actions_secrets.rb', line 123

def list_actions_environment_secrets(repo, environment)
  paginate "#{Repository.path repo}/environments/#{environment}/secrets" do |data, last_response|
    data.secrets.concat last_response.data.secrets
  end
end

#list_actions_secrets(repo) ⇒ Hash

List secrets

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

Returns:

  • (Hash)

    total_count and list of secrets (each item is hash with name, created_at and updated_at)

See Also:



32
33
34
35
36
# File 'lib/octokit/client/actions_secrets.rb', line 32

def list_actions_secrets(repo)
  paginate "#{Repository.path repo}/actions/secrets" do |data, last_response|
    data.secrets.concat last_response.data.secrets
  end
end

#list_org_actions_secrets(org) ⇒ Hash

List org secrets

Parameters:

  • org (String)

    A GitHub organization

Returns:

  • (Hash)

    total_count and list of secrets (each item is hash with name, created_at and updated_at)

See Also:



43
44
45
46
47
# File 'lib/octokit/client/actions_secrets.rb', line 43

def list_org_actions_secrets(org)
  paginate "#{Organization.path org}/actions/secrets" do |data, last_response|
    data.secrets.concat last_response.data.secrets
  end
end