Add @octokit/plugin-request-log, to produce debug output for requests

Without this plugin, the debug setting is, effectively, meaningless as
none of the existing plugins produce log output.

The plugin writes the request options to octokit.log.debug, and response
times as *method path - status in ...ms* to octokit.log.info.
This commit is contained in:
Martijn Pieters 2023-03-30 16:08:48 +01:00
parent 454e5d7e69
commit d415b06b8c
No known key found for this signature in database
5 changed files with 83 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import {context, getOctokit} from '@actions/github'
import {defaults as defaultGitHubOptions} from '@actions/github/lib/utils'
import * as glob from '@actions/glob'
import * as io from '@actions/io'
import {requestLog} from '@octokit/plugin-request-log'
import {retry} from '@octokit/plugin-retry'
import {RequestRequestOptions} from '@octokit/types'
import fetch from 'node-fetch'
@ -45,7 +46,7 @@ async function main(): Promise<void> {
if (previews) opts.previews = previews.split(',')
if (requestOpts) opts.request = requestOpts
const github = getOctokit(token, opts, retry)
const github = getOctokit(token, opts, retry, requestLog)
const script = core.getInput('script', {required: true})
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.