-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Github Repository Release and Release Assets * Repository Deployment Endpoints Added * Repository Environments Added * Additional Repository added build.cake update
- Loading branch information
1 parent
7d90f30
commit 631a177
Showing
9 changed files
with
463 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/Cake.GitHub.Endpoints/GitHubEndpointsRepositoryActionsSecretsAliases.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
namespace Cake.GitHub.Endpoints; | ||
|
||
/// <summary> | ||
/// Contains functionality for working with GitHub Repository Actions Repository Secrets API | ||
/// </summary> | ||
[CakeAliasCategory("GitHub")] | ||
[CakeNamespaceImport("Cake.GitHub.Endpoints")] | ||
public static class GitHubEndpointsRepositoryActionsSecretsAliases | ||
{ | ||
/// <summary> | ||
/// List the secrets for a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/actions/secrets/#list-repository-secrets">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>A <see cref="RepositorySecretsCollection"/> instance for the list of repository secrets.</returns> | ||
public static Task<RepositorySecretsCollection> GitHubRepositoryActionsSecretsGetAll(this IGitHubEndpointContext context) => | ||
context.GitHubClient().Repository.Actions.Secrets.GetAll(context.Owner, context.RepoName); | ||
|
||
/// <summary> | ||
/// Get a secret from a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/actions/secrets/#get-a-repository-secret">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="name">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> | ||
public static Task<RepositorySecret> GitHubRepositoryActionsSecretsGet(this IGitHubEndpointContext context, string name) => | ||
context.GitHubClient().Repository.Actions.Secrets.Get(context.Owner, context.RepoName, name); | ||
|
||
/// <summary> | ||
/// Create or update a secret in a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/actions/secrets/#create-or-update-a-repository-secret">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="name">The name of the variable to create or update</param> | ||
/// <param name="keyId">The id of the encryption key used to encrypt the secret.</param> | ||
/// <remarks>Get key and id from <see cref="RepositorySecretsClient.GetPublicKey(string, string)"/> and use the <a href="https://developer.github.com/v3/actions/secrets/#create-or-update-a-repository-secret">API documentation</a> for more information on how to encrypt the secret</remarks> | ||
/// <param name="encryptedValue">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> | ||
public static Task<RepositorySecret> GitHubRepositoryActionsSecretsCreate(this IGitHubEndpointContext context, string name, string keyId, string encryptedValue) => | ||
context.GitHubClient().Repository.Actions.Secrets.CreateOrUpdate(context.Owner, context.RepoName, name, new UpsertRepositorySecret { EncryptedValue = encryptedValue, KeyId = keyId }); | ||
|
||
/// <summary> | ||
/// Delete a secret in a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/actions/secrets/#delete-a-repository-secret">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="name">The name of the secret</param> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
public static Task GitHubRepositoryActionsSecretsDelete(this IGitHubEndpointContext context, string name) => | ||
context.GitHubClient().Repository.Actions.Secrets.Delete(context.Owner, context.RepoName, name); | ||
} |
83 changes: 83 additions & 0 deletions
83
src/Cake.GitHub.Endpoints/GitHubEndpointsRepositoryActionsVariablesAliases.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
namespace Cake.GitHub.Endpoints; | ||
|
||
/// <summary> | ||
/// Contains functionality for working with GitHub Repository Actions Repository Variables API | ||
/// </summary> | ||
[CakeAliasCategory("GitHub")] | ||
[CakeNamespaceImport("Cake.GitHub.Endpoints")] | ||
public static class GitHubEndpointsRepositoryActionsVariablesAliases | ||
{ | ||
/// <summary> | ||
/// List the variables for a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#list-repository-variables">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
public static Task<RepositoryVariablesCollection> GitHubRepositoryActionsVariablesGetAll(this IGitHubEndpointContext context) => | ||
context.GitHubClient().Repository.Actions.Variables.GetAll(context.Owner, context.RepoName); | ||
|
||
/// <summary> | ||
/// Get a variable from a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#get-a-repository-variable">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="name">The name of the variable</param> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>A <see cref="RepositoryVariable"/> instance for the repository secret.</returns> | ||
public static Task<RepositoryVariable> GitHubRepositoryActionsVariablesGet(this IGitHubEndpointContext context, string name) => | ||
context.GitHubClient().Repository.Actions.Variables.Get(context.Owner, context.RepoName, name); | ||
|
||
/// <summary> | ||
/// List the organization variables for a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#list-repository-organization-variables">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>A <see cref="RepositoryVariablesCollection"/> instance for the list of repository variables.</returns> | ||
public static Task<RepositoryVariablesCollection> GitHubRepositoryActionsVariablesGetAllOrganization(this IGitHubEndpointContext context) => | ||
context.GitHubClient().Repository.Actions.Variables.GetAllOrganization(context.Owner, context.RepoName); | ||
|
||
/// <summary> | ||
/// Create a variable in a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#create-a-repository-variable">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="name">The name of the variable to create</param> | ||
/// <param name="value">The value of the variable to create</param> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>A <see cref="RepositoryVariable"/> instance for the repository variable that was created.</returns> | ||
public static Task<RepositoryVariable> GitHubRepositoryActionsVariablesCreate(this IGitHubEndpointContext context, string name, string value) => | ||
context.GitHubClient().Repository.Actions.Variables.Create(context.Owner, context.RepoName, new Variable(name, value)); | ||
|
||
/// <summary> | ||
/// Update a variable in a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#update-a-repository-variable">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="name">The name of the variable to create</param> | ||
/// <param name="value">The value of the variable to create</param> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
public static Task<RepositoryVariable> GitHubRepositoryActionsVariablesUpdate(this IGitHubEndpointContext context, string name, string value) => | ||
context.GitHubClient().Repository.Actions.Variables.Update(context.Owner, context.RepoName, new Variable(name, value)); | ||
|
||
/// <summary> | ||
/// Delete a variable in a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#delete-a-repository-variable">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="name">The name of the variable</param> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
public static Task GitHubRepositoryActionsVariablesDelete(this IGitHubEndpointContext context, string name) => | ||
context.GitHubClient().Repository.Actions.Variables.Delete(context.Owner, context.RepoName, name); | ||
} |
75 changes: 75 additions & 0 deletions
75
src/Cake.GitHub.Endpoints/GitHubEndpointsRepositoryBranchAliases.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
namespace Cake.GitHub.Endpoints; | ||
|
||
/// <summary> | ||
/// Contains functionality for working with GitHub Repository Branches API | ||
/// </summary> | ||
[CakeAliasCategory("GitHub")] | ||
[CakeNamespaceImport("Cake.GitHub.Endpoints")] | ||
public static class GitHubEndpointsRepositoryBranchAliases | ||
{ | ||
/// <summary> | ||
/// Gets all the branches for the specified repository. | ||
/// </summary> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details | ||
/// </remarks> | ||
public static Task<IReadOnlyList<Branch>> GitHubRepositoryBranch(this IGitHubEndpointContext context) => | ||
context.GitHubClient().Repository.Branch.GetAll(context.Owner, context.RepoName); | ||
|
||
/// <summary> | ||
/// Gets the specified branch. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch">API documentation</a> for more details | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="branch">The name of the branch</param> | ||
public static Task<Branch> GitHubRepositoryBranchGet(this IGitHubEndpointContext context, string branch) => | ||
context.GitHubClient().Repository.Branch.Get(context.Owner, context.RepoName, branch); | ||
|
||
/// <summary> | ||
/// Get the branch protection settings for the specified branch | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch-protection">API documentation</a> for more details | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="branch">The name of the branch</param> | ||
public static Task<BranchProtectionSettings> GitHubRepositoryBranchProtectionGet(this IGitHubEndpointContext context, string branch) => | ||
context.GitHubClient().Repository.Branch.GetBranchProtection(context.Owner, context.RepoName, branch); | ||
|
||
/// <summary> | ||
/// Renames a branch in a repository | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#rename-a-branch">API documentation</a> for more details | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="branch">The name of the branch to rename</param> | ||
/// <param name="newName">The new name of the branch</param> | ||
public static Task<Branch> GitHubRepositoryBranchRename(this IGitHubEndpointContext context, string branch, string newName) => | ||
context.GitHubClient().Repository.Branch.RenameBranch(context.Owner, context.RepoName, branch, newName); | ||
|
||
/// <summary> | ||
/// Get the required status checks for the specified branch | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-required-status-checks-of-protected-branch">API documentation</a> for more details | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="branch">The name of the branch</param> | ||
public static Task<BranchProtectionRequiredStatusChecks> GitHubRepositoryBranchRequiredStatusChecks(this IGitHubEndpointContext context, string branch) => | ||
context.GitHubClient().Repository.Branch.GetRequiredStatusChecks(context.Owner, context.RepoName, branch); | ||
|
||
/// <summary> | ||
/// Get restrictions for the specified branch (applies only to Organization owned repositories) | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-restrictions-of-protected-branch">API documentation</a> for more details | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="branch">The name of the branch</param> | ||
public static Task<BranchProtectionPushRestrictions> GitHubRepositoryBranchProtectedRestrictions(this IGitHubEndpointContext context, string branch) => | ||
context.GitHubClient().Repository.Branch.GetProtectedBranchRestrictions(context.Owner, context.RepoName, branch); | ||
} |
56 changes: 56 additions & 0 deletions
56
src/Cake.GitHub.Endpoints/GitHubEndpointsRepositoryDeploymentsAliases.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
namespace Cake.GitHub.Endpoints; | ||
|
||
/// <summary> | ||
/// Contains functionality for working with GitHub Repository Releases API | ||
/// </summary> | ||
[CakeAliasCategory("GitHub")] | ||
[CakeNamespaceImport("Cake.GitHub.Endpoints")] | ||
public static class GitHubEndpointsRepositoryDeploymentsAliases | ||
{ | ||
/// <summary> | ||
/// Gets all the deployments for the specified repository. Any user with pull access | ||
/// to a repository can view deployments. | ||
/// </summary> | ||
/// <remarks> | ||
/// http://developer.github.com/v3/repos/deployments/#list-deployments | ||
/// </remarks> | ||
public static Task<IReadOnlyList<Deployment>> GitHubRepositoryDeploymentGetAll(this IGitHubEndpointContext context) => | ||
context.GitHubClient().Repository.Deployment.GetAll(context.Owner, context.RepoName, Options.DefaultApiOptions); | ||
|
||
/// <summary> | ||
/// Creates a new deployment for the specified repository. | ||
/// Users with push access can create a deployment for a given ref. | ||
/// </summary> | ||
/// <remarks> | ||
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="deployment">A <see cref="NewDeployment"/> instance describing the new deployment to create</param> | ||
public static Task<Deployment> GitHubRepositoryDeploymentCreate(this IGitHubEndpointContext context, NewDeployment deployment) => | ||
context.GitHubClient().Repository.Deployment.Create(context.Owner, context.RepoName, deployment); | ||
|
||
/// <summary> | ||
/// Gets all the statuses for the given deployment. Any user with pull access to a repository can | ||
/// view deployments. | ||
/// </summary> | ||
/// <remarks> | ||
/// http://developer.github.com/v3/repos/deployments/#list-deployment-statuses | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="deploymentId">The id of the deployment.</param> | ||
public static Task<IReadOnlyList<DeploymentStatus>> GitHubRepositoryDeploymentGetAll(this IGitHubEndpointContext context, int deploymentId) => | ||
context.GitHubClient().Repository.Deployment.Status.GetAll(context.Owner, context.RepoName, deploymentId); | ||
|
||
/// <summary> | ||
/// Creates a new status for the given deployment. Users with push access can create deployment | ||
/// statuses for a given deployment. | ||
/// </summary> | ||
/// <remarks> | ||
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status | ||
/// </remarks> | ||
/// <param name="context">The GitHubEndpointContext context</param> | ||
/// <param name="deploymentId">The id of the deployment.</param> | ||
/// <param name="deploymentStatus">The new deployment status to create.</param> | ||
public static Task<DeploymentStatus> GitHubRepositoryDeploymentCreate(this IGitHubEndpointContext context, int deploymentId, NewDeploymentStatus deploymentStatus) => | ||
context.GitHubClient().Repository.Deployment.Status.Create(context.Owner, context.RepoName, deploymentId, deploymentStatus); | ||
} |
Oops, something went wrong.