8000 Replace `@action/github` dependency with latest Octokit · joshmgross/github-script@f734337 · GitHub
[go: up one dir, main page]

Skip to content

Commit f734337

Browse files
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ uses the GitHub API and the workflow run context.
1010
To use this action, provide an input named `script` that contains the body of an asynchronous JavaScript function call.
1111
The following arguments will be provided:
1212

13-
- `github` A pre-authenticated
13+
- `github`/`octokit` A pre-authenticated
1414
[octokit/rest.js](https://octokit.github.io/rest.js) client with pagination plugins
15-
- `context` An object containing the [context of the workflow
16-
run](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts)
15+
- `context` An object containing partial [context of the workflow run](./src/context.ts)
1716
- `core` A reference to the [@actions/core](https://github.com/actions/toolkit/tree/main/packages/core) package
1817
- `glob` A reference to the [@actions/glob](https://github.com/actions/toolkit/tree/main/packages/glob) package
1918
- `io` A reference to the [@actions/io](https://github.com/actions/toolkit/tree/main/packages/io) package
@@ -33,6 +32,11 @@ documentation.
3332

3433
## Breaking Changes
3534

35+
### V8
36+
37+
Version 8 of this action upgraded `@octokit/core` from v5 to v7, which could impact scripts that would
38+
be impacted by those breaking changes.
39+
3640
### V7
3741

3842
Version 7 of this action updated the runtime to Node 20 - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,30 @@ import {getRetryOptions} from '../src/retry-options'
44

55
describe('getRequestOptions', () => {
66
test('retries disabled if retries == 0', async () => {
7-
const [retryOptions, requestOptions] = getRetryOptions(
8-
0,
9-
[400, 500, 502],
10-
[]
11-
)
7+
const retryOptions = getRetryOptions(0, [400, 500, 502])
128

139
expect(retryOptions.enabled).toBe(false)
1410
expect(retryOptions.doNotRetry).toBeFalsy()
15-
16-
expect(requestOptions?.retries).toBeFalsy()
1711
})
1812

1913
test('properties set if retries > 0', async () => {
20-
const [retryOptions, requestOptions] = getRetryOptions(
21-
1,
22-
[400, 500, 502],
23-
[]
24-
)
14+
const retryOptions = getRetryOptions(1, [400, 500, 502])
2515

2616
expect(retryOptions.enabled).toBe(true)
2717
expect(retryOptions.doNotRetry).toEqual([400, 500, 502])
28-
29-
expect(requestOptions?.retries).toEqual(1)
3018
})
3119

3220
test('properties set if retries > 0', async () => {
33-
const [retryOptions, requestOptions] = getRetryOptions(
34-
1,
35-
[400, 500, 502],
36-
[]
37-
)
21+
const retryOptions = getRetryOptions(1, [400, 500, 502])
3822

3923
expect(retryOptions.enabled).toBe(true)
4024
expect(retryOptions.doNotRetry).toEqual([400, 500, 502])
41-
42-
expect(requestOptions?.retries).toEqual(1)
4325
})
4426

4527
test('retryOptions.doNotRetry not set if exemptStatusCodes isEmpty', async () => {
46-
const [retryOptions, requestOptions] = getRetryOptions(1, [], [])
47-
48-
expect(retryOptions.enabled).toBe(true)
49-
expect(retryOptions.doNotRetry).toBeUndefined()
50-
51-
expect(requestOptions?.retries).toEqual(1)
52-
})
53-
54-
test('requestOptions does not override defaults from @actions/github', async () => {
55-
const [retryOptions, requestOptions] = getRetryOptions(1, [], {
56-
request: {
57-
agent: 'default-user-agent'
58-
},
59-
foo: 'bar'
60-
})
28+
const retryOptions = getRetryOptions(1, [])
6129

6230
expect(retryOptions.enabled).toBe(true)
6331
expect(retryOptions.doNotRetry).toBeUndefined()
64-
65-
expect(requestOptions?.retries).toEqual(1)
66-
expect(requestOptions?.agent).toEqual('default-user-agent')
67-
expect(requestOptions?.foo).toBeUndefined() // this should not be in the `options.request` object, but at the same level as `request`
6832
})
6933
})