Skip to content

Commit 63387d1

Browse files
committed
Improve GitHubApiDetails types and documentation
1 parent eb94de7 commit 63387d1

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

‎src/api-client.ts‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,38 @@ const GITHUB_ENTERPRISE_VERSION_HEADER = "x-github-enterprise-version";
4343
*/
4444
export const DO_NOT_RETRY_STATUSES = [400, 410, 422, 451];
4545

46+
/**
47+
* Represents information about a GitHub instance, how to authenticate to it,
48+
* and how to authenticate to other repos on it.
49+
*/
4650
export type GitHubApiCombinedDetails = GitHubApiDetails &
4751
GitHubApiExternalRepoDetails;
4852

49-
export interface GitHubApiDetails {
50-
auth: string;
53+
/** Represents information about a GitHub instance. */
54+
export type GitHubInstance = {
55+
/** The base URL of the GitHub instance, such as `https://github.com`. */
5156
url: string;
57+
/**
58+
* The API base URL of the GitHub instance, such as `https://api.github.com`.
59+
* Typically this is the `api.` subdomain of the `url` domain.
60+
*/
5261
apiURL: string | undefined;
53-
}
62+
};
63+
64+
/** Represents a {@link GitHubInstance} with a token for accessing the API. */
65+
export type GitHubApiDetails = GitHubInstance & {
66+
/** The token to use for accessing the API of the GitHub instance. */
67+
auth: string;
68+
};
5469

55-
export interface GitHubApiExternalRepoDetails {
70+
/**
71+
* Represents information for accessing a repository on the same GitHub instance as the Action
72+
* is currently running on.
73+
*/
74+
export type GitHubApiExternalRepoDetails = {
75+
/** An optional token for accessing repo(s) on the same GitHub instance. */
5676
externalRepoAuth?: string;
57-
url: string;
58-
apiURL: string | undefined;
59-
}
77+
};
6078

6179
/**
6280
* Gets the configuration for the private registry authentication proxy,

0 commit comments

Comments
 (0)