@@ -10,8 +10,8 @@ uses the GitHub API and the workflow run context.
10
10
To use this action, provide an input named ` script ` that contains the body of an asynchronous JavaScript function call.
11
11
The following arguments will be provided:
12
12
13
- - ` github ` A pre-authenticated
14
- [ octokit/rest.js] ( https://octokit.github.io/rest.js ) client with pagination plugins
13
+ - ` octokit ` (and ` github ` ) A pre-authenticated
14
+ [ octokit/rest.js] ( https://octokit.github.io/rest.js ) client _ instance _ with pagination plugins
15
15
- ` context ` An object containing the [ context of the workflow
16
16
run] ( https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts )
17
17
- ` core ` A reference to the [ @actions/core ] ( https://github.com/actions/toolkit/tree/main/packages/core ) package
@@ -102,14 +102,14 @@ By default, requests made with the `github` instance will not be retried. You ca
102
102
result-encoding: string
103
103
retries: 3
104
104
script: |
105
- github .rest.issues.get({
105
+ octokit .rest.issues.get({
106
106
issue_number: context.issue.number,
107
107
owner: context.repo.owner,
108
108
repo: context.repo.repo,
109
109
})
110
110
` ` `
111
111
112
- In this example, request failures from `github .rest.issues.get()` will be retried up to 3 times.
112
+ In this example, request failures from `octokit .rest.issues.get()` will be retried up to 3 times.
113
113
114
114
You can also configure which status codes should be exempt from retries via the `retry-exempt-status-codes` option :
115
115
@@ -121,7 +121,7 @@ You can also configure which status codes should be exempt from retries via the
121
121
retries: 3
122
122
retry-exempt-status-codes: 400,401
123
123
script: |
124
- github .rest.issues.get({
124
+ octokit .rest.issues.get({
125
125
issue_number: context.issue.number,
126
126
owner: context.repo.owner,
127
127
repo: context.repo.repo,
@@ -162,7 +162,7 @@ jobs:
162
162
- uses: actions/github-script@v7
163
163
with:
164
164
script: |
165
- github .rest.issues.createComment({
165
+ octokit .rest.issues.createComment({
166
166
issue_number: context.issue.number,
167
167
owner: context.repo.owner,
168
168
repo: context.repo.repo,
@@ -184,7 +184,7 @@ jobs:
184
184
- uses: actions/github-script@v7
185
185
with:
186
186
script: |
187
- github .rest.issues.addLabels({
187
+ octokit .rest.issues.addLabels({
188
188
issue_number: context.issue.number,
189
189
owner: context.repo.owner,
190
190
repo: context.repo.repo,
@@ -209,12 +209,12 @@ jobs:
209
209
// Get a list of all issues created by the PR opener
210
210
// See: https://octokit.github.io/rest.js/#pagination
211
211
const creator = context.payload.sender.login
212
- const opts = github .rest.issues.listForRepo.endpoint.merge({
212
+ const opts = octokit .rest.issues.listForRepo.endpoint.merge({
213
213
...context.issue,
214
214
creator,
215
215
state: 'all'
216
216
})
217
- const issues = await github .paginate(opts)
217
+ const issues = await octokit .paginate(opts)
218
218
219
219
for (const issue of issues) {
220
220
if (issue.number === context.issue.number) {
@@ -226,7 +226,7 @@ jobs:
226
226
}
227
227
}
228
228
229
- await github .rest.issues.createComment({
229
+ await octokit .rest.issues.createComment({
230
230
issue_number: context.issue.number,
231
231
owner: context.repo.owner,
232
232
repo: context.repo.repo,
@@ -252,7 +252,7 @@ jobs:
252
252
with :
253
253
script : |
254
254
const diff_url = context.payload.pull_request.diff_url
255
- const result = await github .request(diff_url)
255
+ const result = await octokit .request(diff_url)
256
256
console.log(result)
257
257
` ` `
258
258
@@ -289,7 +289,7 @@ jobs:
289
289
name : context.repo.repo,
290
290
label : ' wontfix'
291
291
}
292
- const result = await github .graphql(query, variables)
292
+ const result = await octokit .graphql(query, variables)
293
293
console.log(result)
294
294
```
295
295
@@ -310,13 +310,13 @@ jobs:
310
310
with :
311
311
script : |
312
312
const script = require('./path/to/script.js')
313
- console.log(script({github , context}))
313
+ console.log(script({octokit , context}))
314
314
` ` `
315
315
316
316
And then export a function from your module:
317
317
318
318
` ` ` javascript
319
- module.exports = ({github , context}) => {
319
+ module.exports = ({octokit , context}) => {
320
320
return context.payload.client_payload.value
321
321
}
322
322
```
@@ -350,15 +350,15 @@ jobs:
350
350
with :
351
351
script : |
352
352
const script = require('./path/to/script.js')
353
- await script({github , context, core})
353
+ await script({octokit , context, core})
354
354
` ` `
355
355
356
356
And then export an async function from your module:
357
357
358
358
` ` ` javascript
359
- module.exports = async ({github , context, core}) => {
359
+ module.exports = async ({octokit , context, core}) => {
360
360
const {SHA} = process.env
361
- const commit = await github .rest.repos.getCommit({
361
+ const commit = await octokit .rest.repos.getCommit({
362
362
owner : context.repo.owner,
363
363
repo : context.repo.repo,
364
364
ref : ` ${SHA}`
@@ -487,7 +487,7 @@ jobs:
487
487
with :
488
488
github-token : ${{ secrets.MY_PAT }}
489
489
script : |
490
- github .rest.issues.addLabels({
490
+ octokit .rest.issues.addLabels({
491
491
issue_number: context.issue.number,
492
492
owner: context.repo.owner,
493
493
repo: context.repo.repo,
0 commit comments