@actions/github
Advanced tools
Comparing version 5.0.0 to 5.1.1
import * as Context from './context'; | ||
import { GitHub } from './utils'; | ||
import { OctokitOptions } from '@octokit/core/dist-types/types'; | ||
import { OctokitOptions, OctokitPlugin } from '@octokit/core/dist-types/types'; | ||
export declare const context: Context.Context; | ||
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare function getOctokit(token: string, options?: OctokitOptions): InstanceType<typeof GitHub>; | ||
export declare function getOctokit(token: string, options?: OctokitOptions, ...additionalPlugins: OctokitPlugin[]): InstanceType<typeof GitHub>; |
@@ -32,6 +32,7 @@ "use strict"; | ||
*/ | ||
function getOctokit(token, options) { | ||
return new utils_1.GitHub(utils_1.getOctokitOptions(token, options)); | ||
function getOctokit(token, options, ...additionalPlugins) { | ||
const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins); | ||
return new GitHubWithPlugins(utils_1.getOctokitOptions(token, options)); | ||
} | ||
exports.getOctokit = getOctokit; | ||
//# sourceMappingURL=github.js.map |
@@ -5,2 +5,3 @@ import * as Context from './context'; | ||
export declare const context: Context.Context; | ||
export declare const defaults: OctokitOptions; | ||
export declare const GitHub: typeof Octokit & import("@octokit/core/dist-types/types").Constructor<import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & { | ||
@@ -7,0 +8,0 @@ paginate: import("@octokit/plugin-paginate-rest").PaginateInterface; |
@@ -22,3 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getOctokitOptions = exports.GitHub = exports.context = void 0; | ||
exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0; | ||
const Context = __importStar(require("./context")); | ||
@@ -32,3 +32,3 @@ const Utils = __importStar(require("./internal/utils")); | ||
const baseUrl = Utils.getApiBaseUrl(); | ||
const defaults = { | ||
exports.defaults = { | ||
baseUrl, | ||
@@ -39,3 +39,3 @@ request: { | ||
}; | ||
exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(defaults); | ||
exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults); | ||
/** | ||
@@ -42,0 +42,0 @@ * Convience function to correctly format Octokit Options to pass into the constructor. |
{ | ||
"name": "@actions/github", | ||
"version": "5.0.0", | ||
"version": "5.1.1", | ||
"description": "Actions github lib", | ||
@@ -41,11 +41,10 @@ "keywords": [ | ||
"dependencies": { | ||
"@actions/http-client": "^1.0.11", | ||
"@octokit/core": "^3.4.0", | ||
"@octokit/plugin-paginate-rest": "^2.13.3", | ||
"@octokit/plugin-rest-endpoint-methods": "^5.1.1" | ||
"@actions/http-client": "^2.0.1", | ||
"@octokit/core": "^3.6.0", | ||
"@octokit/plugin-paginate-rest": "^2.17.0", | ||
"@octokit/plugin-rest-endpoint-methods": "^5.13.0" | ||
}, | ||
"devDependencies": { | ||
"jest": "^26.6.3", | ||
"proxy": "^1.0.2" | ||
} | ||
} |
@@ -62,5 +62,5 @@ # `@actions/github` | ||
The npm module `@octokit/webhooks` provides type definitions for the response payloads. You can cast the payload to these types for better type information. | ||
The npm module `@octokit/webhooks-definitions` provides type definitions for the response payloads. You can cast the payload to these types for better type information. | ||
First, install the npm module `npm install @octokit/webhooks` | ||
First, install the npm module `npm install @octokit/webhooks-definitions` | ||
@@ -71,6 +71,7 @@ Then, assert the type based on the eventName | ||
import * as github from '@actions/github' | ||
import * as Webhooks from '@octokit/webhooks' | ||
import {PushEvent} from '@octokit/webhooks-definitions/schema' | ||
if (github.context.eventName === 'push') { | ||
const pushPayload = github.context.payload as Webhooks.WebhookPayloadPush | ||
core.info(`The head commit is: ${pushPayload.head}`) | ||
const pushPayload = github.context.payload as PushEvent | ||
core.info(`The head commit is: ${pushPayload.head_commit}`) | ||
} | ||
@@ -77,0 +78,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20909
1
291
99
+ Added@actions/http-client@2.2.3(transitive)
+ Added@fastify/busboy@2.1.1(transitive)
+ Addedundici@5.28.4(transitive)
- Removed@actions/http-client@1.0.11(transitive)
Updated@actions/http-client@^2.0.1
Updated@octokit/core@^3.6.0