Class GitHub
Implements common GitHub operations via the GitHub REST API.
Namespace: Neon.Deployment
Assembly: Neon.Deployment.dll
Syntax
public static class GitHub
Remarks
To use this class, first call GetCredentials() to load the necessary credentials from 1Password and the call the desired APIs. When you're done, it's a good practice to call ClearCredentials().
note
This class currently requires that the GITHUB_PAT environment variable or GITHUB[accesstoken] secret be available via 1Password for the current user.
Fields
UserAgent
Specifies the User-Agent string used when submitting REST API requests to GitHub. This defaults to neon-sdk but may be customized.
Declaration
public static string UserAgent
Field Value
| Type | Description |
|---|---|
| string |
Properties
Actions
Returns the API class for managing GitHub Actions.
Declaration
public static GitHubActionsApi Actions { get; }
Property Value
| Type | Description |
|---|---|
| GitHubActionsApi |
Packages
Returns the API class for managing GitHub packages.
Declaration
public static GitHubPackageApi Packages { get; }
Property Value
| Type | Description |
|---|---|
| GitHubPackageApi |
Releases
Returns the API class for managing GitHub releases.
Declaration
public static GitHubReleaseApi Releases { get; }
Property Value
| Type | Description |
|---|---|
| GitHubReleaseApi |
Tags
Returns the API class for managing GutHub tags.
Declaration
public static GitHubTagApi Tags { get; }
Property Value
| Type | Description |
|---|---|
| GitHubTagApi |
Methods
ClearCredentials()
Clears any cached credentials.
Declaration
public static void ClearCredentials()
CreateClient(string)
Creates a REST client that can be used to manage GitHub.
Declaration
public static GitHubClient CreateClient(string userAgent = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userAgent | Optionally identifies the user agent. This defaults to "neon-sdk". |
Returns
| Type | Description |
|---|---|
| GitHubClient | The GitHubClient instance. |
GetCredentials()
Retrieves the necessary credentials from 1Password when necessary and caches them locally as well as in environment variables.
Declaration
public static void GetCredentials()