Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e3a73c3961 | |||
| f0ffb18355 |
@@ -4,9 +4,6 @@ module.exports = {
|
||||
roots: ['<rootDir>/packages'],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/__tests__/*.test.ts'],
|
||||
moduleNameMapper: {
|
||||
'^(\\.{1,2}/.*)\\.js$': '$1'
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.(ts|js)$': ['ts-jest', {
|
||||
isolatedModules: true,
|
||||
|
||||
@@ -6,20 +6,9 @@
|
||||
|
||||
Returns an authenticated Octokit client that follows the machine [proxy settings](https://help.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners) and correctly sets GHES base urls. See https://octokit.github.io/rest.js for the API.
|
||||
|
||||
**Note:** This package is ESM-only starting from v9.0.0. For CommonJS projects, use dynamic import:
|
||||
```js
|
||||
async function main() {
|
||||
const { getOctokit, context } = await import('@actions/github');
|
||||
// ... your code here
|
||||
}
|
||||
main();
|
||||
```
|
||||
|
||||
For bundled actions (recommended), most bundlers like esbuild, webpack, and rollup handle ESM imports automatically.
|
||||
|
||||
```js
|
||||
import * as github from '@actions/github';
|
||||
import * as core from '@actions/core';
|
||||
const github = require('@actions/github');
|
||||
const core = require('@actions/core');
|
||||
|
||||
async function run() {
|
||||
// This should be a token with access to your repository scoped in as a secret.
|
||||
@@ -57,7 +46,7 @@ const result = await octokit.graphql(query, variables);
|
||||
Finally, you can get the context of the current action:
|
||||
|
||||
```js
|
||||
import * as github from '@actions/github';
|
||||
const github = require('@actions/github');
|
||||
|
||||
const context = github.context;
|
||||
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
# @actions/github Releases
|
||||
|
||||
### 9.0.0
|
||||
|
||||
- **Breaking change**: Package is now ESM-only
|
||||
- CommonJS consumers must use dynamic `import()` instead of `require()`
|
||||
- Example: `const { getOctokit, context } = await import('@actions/github')`
|
||||
- Fix TypeScript compilation by migrating to ESM, enabling proper imports from `@octokit/core/types`
|
||||
|
||||
### 8.0.1
|
||||
|
||||
- Update `undici` to `6.23.0`
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import * as path from 'path'
|
||||
import {readFileSync} from 'fs'
|
||||
import {Context} from '../src/context.js'
|
||||
import {Context} from '../src/context'
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
describe('@actions/context', () => {
|
||||
let context: Context
|
||||
@@ -12,10 +14,7 @@ describe('@actions/context', () => {
|
||||
})
|
||||
|
||||
it('returns the payload object', () => {
|
||||
const payload = JSON.parse(
|
||||
readFileSync(path.join(__dirname, 'payload.json'), 'utf8')
|
||||
)
|
||||
expect(context.payload).toEqual(payload)
|
||||
expect(context.payload).toEqual(require('./payload.json'))
|
||||
})
|
||||
|
||||
it('returns an empty payload if the GITHUB_EVENT_PATH environment variable is falsey', () => {
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
/** @type {import('jest').Config} */
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
moduleNameMapper: {
|
||||
'^(\\.{1,2}/.*)\\.js$': '$1'
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.(ts|js)$': ['ts-jest', {
|
||||
useESM: false,
|
||||
tsconfig: {
|
||||
allowJs: true,
|
||||
esModuleInterop: true,
|
||||
module: 'node16',
|
||||
moduleResolution: 'node16'
|
||||
esModuleInterop: true
|
||||
}
|
||||
}]
|
||||
},
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@actions/github",
|
||||
"version": "9.0.0",
|
||||
"version": "8.0.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@actions/github",
|
||||
"version": "9.0.0",
|
||||
"version": "8.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^3.0.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@actions/github",
|
||||
"version": "9.0.0",
|
||||
"version": "8.0.1",
|
||||
"description": "Actions github lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
@@ -8,19 +8,8 @@
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/github",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"main": "lib/github.js",
|
||||
"types": "lib/github.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./lib/github.d.ts",
|
||||
"import": "./lib/github.js"
|
||||
},
|
||||
"./lib/utils": {
|
||||
"types": "./lib/utils.d.ts",
|
||||
"import": "./lib/utils.js"
|
||||
}
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/main/src/context.ts
|
||||
import {WebhookPayload} from './interfaces.js'
|
||||
import {WebhookPayload} from './interfaces'
|
||||
import {readFileSync, existsSync} from 'fs'
|
||||
import {EOL} from 'os'
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import * as Context from './context.js'
|
||||
import {GitHub, getOctokitOptions} from './utils.js'
|
||||
import * as Context from './context'
|
||||
import {GitHub, getOctokitOptions} from './utils'
|
||||
|
||||
// octokit + plugins
|
||||
import type {OctokitOptions, OctokitPlugin} from '@octokit/core/types'
|
||||
import {OctokitOptions, OctokitPlugin} from '@octokit/core/dist-types/types'
|
||||
|
||||
export const context = new Context.Context()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as http from 'http'
|
||||
import * as httpClient from '@actions/http-client'
|
||||
import type {OctokitOptions} from '@octokit/core/types'
|
||||
import {OctokitOptions} from '@octokit/core/dist-types/types'
|
||||
import {ProxyAgent, fetch} from 'undici'
|
||||
|
||||
export function getAuthString(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as Context from './context.js'
|
||||
import * as Utils from './internal/utils.js'
|
||||
import type {OctokitOptions} from '@octokit/core/types'
|
||||
import * as Context from './context'
|
||||
import * as Utils from './internal/utils'
|
||||
|
||||
// octokit + plugins
|
||||
import {Octokit} from '@octokit/core'
|
||||
import {OctokitOptions} from '@octokit/core/dist-types/types'
|
||||
import {restEndpointMethods} from '@octokit/plugin-rest-endpoint-methods'
|
||||
import {paginateRest} from '@octokit/plugin-paginate-rest'
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./lib",
|
||||
"rootDir": "./src",
|
||||
"module": "node16",
|
||||
"moduleResolution": "node16"
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": [
|
||||
"./src"
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
# @actions/glob Releases
|
||||
|
||||
### 0.5.1
|
||||
|
||||
- Bump `@actions/core` to `2.0.3`
|
||||
|
||||
### 0.5.0
|
||||
- Added `excludeHiddenFiles` option, which is disabled by default to preserve existing behavior [#1791: Add glob option to ignore hidden files](https://github.com/actions/toolkit/pull/1791)
|
||||
|
||||
|
||||
Generated
+35
-23
@@ -1,53 +1,62 @@
|
||||
{
|
||||
"name": "@actions/glob",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@actions/glob",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^2.0.3",
|
||||
"@actions/core": "^1.9.1",
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-2.0.3.tgz",
|
||||
"integrity": "sha512-Od9Thc3T1mQJYddvVPM4QGiLUewdh+3txmDYHHxoNdkqysR1MbCT+rFOtNUxYAz+7+6RIsqipVahY2GJqGPyxA==",
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
|
||||
"integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/exec": "^2.0.0",
|
||||
"@actions/http-client": "^3.0.2"
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/http-client": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/exec": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-2.0.0.tgz",
|
||||
"integrity": "sha512-k8ngrX2voJ/RIN6r9xB82NVqKpnMRtxDoiO+g3olkIUpQNqjArXrCQceduQZCQj3P3xm32pChRLqRrtXTlqhIw==",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
|
||||
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/io": "^2.0.0"
|
||||
"@actions/io": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/http-client": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.2.tgz",
|
||||
"integrity": "sha512-JP38FYYpyqvUsz+Igqlc/JG6YO9PaKuvqjM3iGvaLqFnJ7TFmcLyy2IDrY0bI0qCQug8E9K+elv5ZNfw62ZJzA==",
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz",
|
||||
"integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tunnel": "^0.0.6",
|
||||
"undici": "^6.23.0"
|
||||
"undici": "^5.25.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/io": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-2.0.0.tgz",
|
||||
"integrity": "sha512-Jv33IN09XLO+0HS79aaODsvIRyduiF7NY/F6LYeK5oeUmrsz7aFdRphQjFoESF4jS7lMauDOttKALcpapVDIAg==",
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz",
|
||||
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@fastify/busboy": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
|
||||
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
@@ -92,12 +101,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "6.23.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
|
||||
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
|
||||
"version": "5.29.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
|
||||
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.17"
|
||||
"node": ">=14.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@actions/glob",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.0",
|
||||
"preview": true,
|
||||
"description": "Actions glob lib",
|
||||
"keywords": [
|
||||
@@ -37,7 +37,7 @@
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^2.0.3",
|
||||
"@actions/core": "^1.9.1",
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user