Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented GitHub Actions Secrets API for both Organization and Repository #2221

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
2a1895a
created the interface and models for the repository secrets client
mptolly-takeda Jun 25, 2020
1bbf846
created a repository actions client to sit between repository and sec…
mptolly-takeda Jun 25, 2020
67d5355
created the repository secret client and supporting objects to enable…
mptolly-takeda Jun 25, 2020
cff4518
created object for create or update secret body and made fixes to pas…
mptolly-takeda Jun 25, 2020
f69cce6
created repository action unit tests
mptolly-takeda Jun 25, 2020
d2a61b2
created unit tests for RepositorySecretsClient
mptolly-takeda Jun 25, 2020
84a8fb8
removed set from secrets interface
mptolly-takeda Jun 25, 2020
3778bd6
fixed docs and added observable actions client
mptolly-takeda Jun 26, 2020
717dd73
added Actions to repository client
mptolly-takeda Jun 26, 2020
d4cde85
created IObservable repository secrets client
mptolly-takeda Jun 26, 2020
1665f26
fixed property in wrong interface
mptolly-takeda Jun 26, 2020
6653736
created repository decrets reactive tests and clients
mptolly-takeda Jun 26, 2020
93e6608
created organization actions and scerets classes and made them availa…
mptolly-takeda Jun 26, 2020
1747a2d
fixed intellisense text
mptolly-takeda Jun 27, 2020
3ff14a2
removed uneeded getall call after return type change
mptolly-takeda Jun 27, 2020
4b43db6
created organization secret client and classes to support it
mptolly-takeda Jun 30, 2020
788cf25
created the observable org secrets client and fixed a typo in a metho…
mptolly-takeda Jun 30, 2020
b1b0f2b
added more ensure checks
mptolly-takeda Jun 30, 2020
900ede1
removed unused xml doc setting
mptolly-takeda Jun 30, 2020
c0bce5e
created the unit tests for the organization secrets client
mptolly-takeda Jun 30, 2020
6938225
created observable organization actions and secrets client unit tests
mptolly-takeda Jul 1, 2020
90e180e
added sodium.core to the integration tests to test secret creation
mptolly-takeda Jul 1, 2020
1f7a1f9
fixed keyid type
mptolly-takeda Jul 2, 2020
bf504bb
added actions client integration test classes (empty since the class …
mptolly-takeda Jul 6, 2020
026fb7c
fixed deserialization issue
mptolly-takeda Jul 6, 2020
8fa2ec9
changed property name for deserialization issues
mptolly-takeda Jul 6, 2020
48358c5
added doc for repoid on orginzation secrets url generator
mptolly-takeda Jul 6, 2020
045fe8c
created integration tests for repository and organization secrets
mptolly-takeda Jul 6, 2020
a25278d
changed how return occurs for setting list of repos for secret
mptolly-takeda Jul 6, 2020
28be033
fixed some names and removed reset org name
mptolly-takeda Jul 6, 2020
1c7fbe5
created integration tests for observable org secrets client
mptolly-takeda Jul 7, 2020
635ccc6
removed default org value
mptolly-takeda Jul 7, 2020
054cc2c
created the integration tests for the observable repository secrets c…
mptolly-takeda Jul 7, 2020
8a74f2e
removed default owner project value
mptolly-takeda Jul 7, 2020
2927d80
fixed unit tests
mptolly-takeda Jul 7, 2020
a186d31
Update links to new docs site
IAmHughes Aug 12, 2020
49d8626
Update doc links to new docs site
IAmHughes Aug 12, 2020
398fb8f
Update docs links to new docs site
IAmHughes Aug 12, 2020
c88f02b
Fix doc link to point to new docs site
IAmHughes Aug 12, 2020
f27d78c
Update links to new docs site
IAmHughes Aug 12, 2020
6c5e923
Update doc links to new docs site
IAmHughes Aug 12, 2020
4c7a383
Update docs links
IAmHughes Aug 12, 2020
e7f04f8
Update docs
IAmHughes Aug 12, 2020
67e4c6f
Update docs
IAmHughes Aug 12, 2020
4ca258f
Update doc links
IAmHughes Aug 12, 2020
92c0e90
Update docs
IAmHughes Aug 12, 2020
e36ffa0
Update doc links
IAmHughes Aug 12, 2020
5fc0be6
Update doc links
IAmHughes Aug 12, 2020
fcf32eb
Update doc links
IAmHughes Aug 12, 2020
7a88f33
updated documentation links in actions and secrets clients
mptolly-takeda Aug 12, 2020
b14281a
Merge branch 'main' of https://github.com/mptolly-takeda/octokit.net …
mptolly-takeda Aug 12, 2020
3dc3b20
Update Octokit/Models/Response/SecretsPublicKey.cs
mptolly-takeda Aug 12, 2020
3797ee9
Update Octokit/Models/Response/RepositorySecret.cs
mptolly-takeda Aug 12, 2020
f02cfb0
set default owner and repo
mptolly-takeda Oct 26, 2020
060a4d0
switched to using the Helper.Organization from a ORG constant set at …
mptolly-takeda Oct 26, 2020
163e538
swapped out variable at top of file for the Helper.Organization property
mptolly-takeda Oct 27, 2020
b69eba1
switched to helper method to create new repositories
mptolly-takeda Oct 27, 2020
c370d1a
Merge branch 'main' into main
nickfloyd Jul 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Octokit.Reactive/Clients/IObservableOrganizationActionsClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Org Actions API.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions"> Actions API documentation</a> for more information.
/// </remarks>
public interface IObservableOrganizationActionsClient
{
/// <summary>
/// Returns a client to manage organization secrets.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#secrets"> Secrets API documentation</a> for more information.
/// </remarks>
IObservableOrganizationSecretsClient Secrets { get; }
}
}
119 changes: 119 additions & 0 deletions Octokit.Reactive/Clients/IObservableOrganizationSecretsClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using System;
using System.Reactive;

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Organization Secrets API.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#secrets">Organization Secrets API documentation</a> for more details.
/// </remarks>
public interface IObservableOrganizationSecretsClient
{
/// <summary>
/// Get the public signing key to encrypt secrets for an organization.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key">API documentation</a> for more information.
/// </remarks>
/// <param name="org">The name of the organization</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="SecretsPublicKey"/> instance for the organization public key.</returns>
IObservable<SecretsPublicKey> GetPublicKey(string org);

/// <summary>
/// List the secrets for an organization.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#list-organization-secrets">API documentation</a> for more information.
/// </remarks>
/// <param name="org">The name of the organization</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="OrganizationSecretsCollection"/> instance for the list of organization secrets.</returns>
IObservable<OrganizationSecretsCollection> GetAll(string org);

/// <summary>
/// Get a secret from an organization.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#get-an-organization-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="org">The name of the organization</param>
/// <param name="secretName">The name of the secret</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="OrganizationSecret"/> instance for the organization secret.</returns>
IObservable<OrganizationSecret> Get(string org, string secretName);

/// <summary>
/// Create or update a secret in an organization.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#create-or-update-an-organization-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="org">The name of the organization</param>
/// <param name="secretName">The name of the secret</param>
/// <param name="upsertSecret">The encrypted value, id of the encryption key, and visibility info to upsert</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="OrganizationSecret"/> instance for the organization secret that was created or updated.</returns>
IObservable<OrganizationSecret> CreateOrUpdate(string org, string secretName, UpsertOrganizationSecret upsertSecret);

/// <summary>
/// Delete a secret in an organization.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#delete-an-organization-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="org">The name of the organization</param>
/// <param name="secretName">The name of the secret</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<Unit> Delete(string org, string secretName);

/// <summary>
/// Get the list of selected sites that have access to a secret.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#list-selected-repositories-for-an-organization-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="org">The name of the organization</param>
/// <param name="secretName">The name of the secret</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<OrganizationSecretRepositoryCollection> GetSelectedRepositoriesForSecret(string org, string secretName);

/// <summary>
/// Set the list of selected sites that have access to a secret.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#set-selected-repositories-for-an-organization-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="org">The name of the organization</param>
/// <param name="secretName">The name of the secret</param>
/// <param name="repositories">The list of repositories that should have access to view and use the secret</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<Unit> SetSelectedRepositoriesForSecret(string org, string secretName, SelectedRepositoryCollection repositories);

/// <summary>
/// Add a selected site to the visibility list of a secret.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#add-selected-repository-to-an-organization-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="org">The name of the organization</param>
/// <param name="secretName">The name of the secret</param>
/// <param name="repoId">The id of the repo to add to the visibility list of the secret</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<Unit> AddRepoToOrganizationSecret(string org, string secretName, long repoId);

/// <summary>
/// ARemoved a selected site from the visibility list of a secret.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#remove-selected-repository-from-an-organization-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="org">The name of the organization</param>
/// <param name="secretName">The name of the secret</param>
/// <param name="repoId">The id of the repo to add to the visibility list of the secret</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<Unit> RemoveRepoFromOrganizationSecret(string org, string secretName, long repoId);
}
}
5 changes: 5 additions & 0 deletions Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public interface IObservableOrganizationsClient
/// </summary>
IObservableOrganizationOutsideCollaboratorsClient OutsideCollaborator { get; }

/// <summary>
/// Returns a client to manage organization actions.
/// </summary>
IObservableOrganizationActionsClient Actions { get; }

/// <summary>
/// Returns the specified organization.
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ public interface IObservableRepositoriesClient
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
IObservable<Repository> GetAllForOrg(string organization, ApiOptions options);

/// <summary>
/// Access GitHub's Repository Actions API.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions">API documentation</a> for more details.
/// </remarks>
IObservableRepositoryActionsClient Actions { get; }

/// <summary>
/// Client for managing branches in a repository.
/// </summary>
Expand Down
23 changes: 23 additions & 0 deletions Octokit.Reactive/Clients/IObservableRepositoryActionsClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Repository Actions API.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions">Repository Actions API documentation</a> for more details.
/// </remarks>
public interface IObservableRepositoryActionsClient
{
/// <summary>
/// Client for GitHub's Repository Actions API
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions">Deployments API documentation</a> for more details
/// </remarks>
IObservableRepositorySecretsClient Secrets { get; }
}
}
79 changes: 79 additions & 0 deletions Octokit.Reactive/Clients/IObservableRepositorySecretsClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Reactive;
using System.Text;

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Repository Secrets API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/actions/secrets/">Repository Secrets API documentation</a> for more details.
/// </remarks>
public interface IObservableRepositorySecretsClient
{
/// <summary>
/// Get the public signing key to encrypt secrets for a repository.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key">API documentation</a> for more information.
/// </remarks>
/// <param name="repoName">The owner of the repository</param>
/// <param name="owner">The name of the repository</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="SecretsPublicKey"/> instance for the repository public key.</returns>
IObservable<SecretsPublicKey> GetPublicKey(string owner, string repoName);

/// <summary>
/// List the secrets for a repository.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#list-repository-secrets">API documentation</a> for more information.
/// </remarks>
/// <param name="repoName">The owner of the repository</param>
/// <param name="owner">The name of the repository</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="IEnumerable{RepositorySecret}"/> instance for the list of repository secrets.</returns>
IObservable<RepositorySecretsCollection> GetAll(string owner, string repoName);

/// <summary>
/// Get a secret from a repository.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#get-a-repository-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="repoName">The owner of the repository</param>
/// <param name="owner">The name of the repository</param>
/// <param name="secretName">The name of the secret</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="RepositorySecret"/> instance for the repository secret.</returns>
IObservable<RepositorySecret> Get(string owner, string repoName, string secretName);

/// <summary>
/// Create or update a secret in a repository.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#create-or-update-a-repository-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="repoName">The owner of the repository</param>
/// <param name="owner">The name of the repository</param>
/// <param name="secretName">The name of the secret</param>
/// <param name="upsertSecret">The encrypted value and id of the encryption key</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="RepositorySecret"/> instance for the repository secret that was created or updated.</returns>
IObservable<RepositorySecret> CreateOrUpdate(string owner, string repoName, string secretName, UpsertRepositorySecret upsertSecret);

/// <summary>
/// Delete a secret in a repository.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#delete-a-repository-secret">API documentation</a> for more information.
/// </remarks>
/// <param name="repoName">The owner of the repository</param>
/// <param name="owner">The name of the repository</param>
/// <param name="secretName">The name of the secret</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<Unit> Delete(string owner, string repoName, string secretName);
}
}
40 changes: 40 additions & 0 deletions Octokit.Reactive/Clients/ObservableOrganizationActionsClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Org Actions API.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions"> Actions API documentation</a> for more information.
/// </remarks>
public class ObservableOrganizationActionsClient : IObservableOrganizationActionsClient
{
readonly IOrganizationActionsClient _client;
readonly IConnection _connection;

/// <summary>
/// Initializes a new Organization API client.
/// </summary>
/// <param name="client">An <see cref="IGitHubClient" /> used to make the requests</param>
public ObservableOrganizationActionsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, nameof(client));

Secrets = new ObservableOrganizationSecretsClient(client);

_client = client.Organization.Actions;
_connection = client.Connection;
}

/// <summary>
/// Returns a client to manage organization secrets.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/reference/actions#secrets"> Secrets API documentation</a> for more information.
/// </remarks>
public IObservableOrganizationSecretsClient Secrets { get; private set; }
}
}
Loading