mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2025-12-18 08:28:28 +00:00
feat: support merge_groups for only new issues
This commit is contained in:
parent
3adb6d0473
commit
f61e9229f8
3 changed files with 148 additions and 527 deletions
318
dist/post_run/index.js
generated
vendored
318
dist/post_run/index.js
generated
vendored
|
|
@ -65683,132 +65683,6 @@ function onConnectTimeout (socket) {
|
||||||
module.exports = buildConnector
|
module.exports = buildConnector
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 4462:
|
|
||||||
/***/ ((module) => {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
|
|
||||||
/** @type {Record<string, string | undefined>} */
|
|
||||||
const headerNameLowerCasedRecord = {}
|
|
||||||
|
|
||||||
// https://developer.mozilla.org/docs/Web/HTTP/Headers
|
|
||||||
const wellknownHeaderNames = [
|
|
||||||
'Accept',
|
|
||||||
'Accept-Encoding',
|
|
||||||
'Accept-Language',
|
|
||||||
'Accept-Ranges',
|
|
||||||
'Access-Control-Allow-Credentials',
|
|
||||||
'Access-Control-Allow-Headers',
|
|
||||||
'Access-Control-Allow-Methods',
|
|
||||||
'Access-Control-Allow-Origin',
|
|
||||||
'Access-Control-Expose-Headers',
|
|
||||||
'Access-Control-Max-Age',
|
|
||||||
'Access-Control-Request-Headers',
|
|
||||||
'Access-Control-Request-Method',
|
|
||||||
'Age',
|
|
||||||
'Allow',
|
|
||||||
'Alt-Svc',
|
|
||||||
'Alt-Used',
|
|
||||||
'Authorization',
|
|
||||||
'Cache-Control',
|
|
||||||
'Clear-Site-Data',
|
|
||||||
'Connection',
|
|
||||||
'Content-Disposition',
|
|
||||||
'Content-Encoding',
|
|
||||||
'Content-Language',
|
|
||||||
'Content-Length',
|
|
||||||
'Content-Location',
|
|
||||||
'Content-Range',
|
|
||||||
'Content-Security-Policy',
|
|
||||||
'Content-Security-Policy-Report-Only',
|
|
||||||
'Content-Type',
|
|
||||||
'Cookie',
|
|
||||||
'Cross-Origin-Embedder-Policy',
|
|
||||||
'Cross-Origin-Opener-Policy',
|
|
||||||
'Cross-Origin-Resource-Policy',
|
|
||||||
'Date',
|
|
||||||
'Device-Memory',
|
|
||||||
'Downlink',
|
|
||||||
'ECT',
|
|
||||||
'ETag',
|
|
||||||
'Expect',
|
|
||||||
'Expect-CT',
|
|
||||||
'Expires',
|
|
||||||
'Forwarded',
|
|
||||||
'From',
|
|
||||||
'Host',
|
|
||||||
'If-Match',
|
|
||||||
'If-Modified-Since',
|
|
||||||
'If-None-Match',
|
|
||||||
'If-Range',
|
|
||||||
'If-Unmodified-Since',
|
|
||||||
'Keep-Alive',
|
|
||||||
'Last-Modified',
|
|
||||||
'Link',
|
|
||||||
'Location',
|
|
||||||
'Max-Forwards',
|
|
||||||
'Origin',
|
|
||||||
'Permissions-Policy',
|
|
||||||
'Pragma',
|
|
||||||
'Proxy-Authenticate',
|
|
||||||
'Proxy-Authorization',
|
|
||||||
'RTT',
|
|
||||||
'Range',
|
|
||||||
'Referer',
|
|
||||||
'Referrer-Policy',
|
|
||||||
'Refresh',
|
|
||||||
'Retry-After',
|
|
||||||
'Sec-WebSocket-Accept',
|
|
||||||
'Sec-WebSocket-Extensions',
|
|
||||||
'Sec-WebSocket-Key',
|
|
||||||
'Sec-WebSocket-Protocol',
|
|
||||||
'Sec-WebSocket-Version',
|
|
||||||
'Server',
|
|
||||||
'Server-Timing',
|
|
||||||
'Service-Worker-Allowed',
|
|
||||||
'Service-Worker-Navigation-Preload',
|
|
||||||
'Set-Cookie',
|
|
||||||
'SourceMap',
|
|
||||||
'Strict-Transport-Security',
|
|
||||||
'Supports-Loading-Mode',
|
|
||||||
'TE',
|
|
||||||
'Timing-Allow-Origin',
|
|
||||||
'Trailer',
|
|
||||||
'Transfer-Encoding',
|
|
||||||
'Upgrade',
|
|
||||||
'Upgrade-Insecure-Requests',
|
|
||||||
'User-Agent',
|
|
||||||
'Vary',
|
|
||||||
'Via',
|
|
||||||
'WWW-Authenticate',
|
|
||||||
'X-Content-Type-Options',
|
|
||||||
'X-DNS-Prefetch-Control',
|
|
||||||
'X-Frame-Options',
|
|
||||||
'X-Permitted-Cross-Domain-Policies',
|
|
||||||
'X-Powered-By',
|
|
||||||
'X-Requested-With',
|
|
||||||
'X-XSS-Protection'
|
|
||||||
]
|
|
||||||
|
|
||||||
for (let i = 0; i < wellknownHeaderNames.length; ++i) {
|
|
||||||
const key = wellknownHeaderNames[i]
|
|
||||||
const lowerCasedKey = key.toLowerCase()
|
|
||||||
headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] =
|
|
||||||
lowerCasedKey
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
|
|
||||||
Object.setPrototypeOf(headerNameLowerCasedRecord, null)
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
wellknownHeaderNames,
|
|
||||||
headerNameLowerCasedRecord
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 8045:
|
/***/ 8045:
|
||||||
|
|
@ -66641,7 +66515,6 @@ const { InvalidArgumentError } = __nccwpck_require__(8045)
|
||||||
const { Blob } = __nccwpck_require__(4300)
|
const { Blob } = __nccwpck_require__(4300)
|
||||||
const nodeUtil = __nccwpck_require__(3837)
|
const nodeUtil = __nccwpck_require__(3837)
|
||||||
const { stringify } = __nccwpck_require__(3477)
|
const { stringify } = __nccwpck_require__(3477)
|
||||||
const { headerNameLowerCasedRecord } = __nccwpck_require__(4462)
|
|
||||||
|
|
||||||
const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
|
const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
|
||||||
|
|
||||||
|
|
@ -66851,15 +66724,6 @@ function parseKeepAliveTimeout (val) {
|
||||||
return m ? parseInt(m[1], 10) * 1000 : null
|
return m ? parseInt(m[1], 10) * 1000 : null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a header name and returns its lowercase value.
|
|
||||||
* @param {string | Buffer} value Header name
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
function headerNameToString (value) {
|
|
||||||
return headerNameLowerCasedRecord[value] || value.toLowerCase()
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseHeaders (headers, obj = {}) {
|
function parseHeaders (headers, obj = {}) {
|
||||||
// For H2 support
|
// For H2 support
|
||||||
if (!Array.isArray(headers)) return headers
|
if (!Array.isArray(headers)) return headers
|
||||||
|
|
@ -67131,7 +66995,6 @@ module.exports = {
|
||||||
isIterable,
|
isIterable,
|
||||||
isAsyncIterable,
|
isAsyncIterable,
|
||||||
isDestroyed,
|
isDestroyed,
|
||||||
headerNameToString,
|
|
||||||
parseRawHeaders,
|
parseRawHeaders,
|
||||||
parseHeaders,
|
parseHeaders,
|
||||||
parseKeepAliveTimeout,
|
parseKeepAliveTimeout,
|
||||||
|
|
@ -73779,18 +73642,14 @@ const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983
|
||||||
const assert = __nccwpck_require__(9491)
|
const assert = __nccwpck_require__(9491)
|
||||||
const { isUint8Array } = __nccwpck_require__(9830)
|
const { isUint8Array } = __nccwpck_require__(9830)
|
||||||
|
|
||||||
let supportedHashes = []
|
|
||||||
|
|
||||||
// https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
|
// https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
|
||||||
/** @type {import('crypto')|undefined} */
|
/** @type {import('crypto')|undefined} */
|
||||||
let crypto
|
let crypto
|
||||||
|
|
||||||
try {
|
try {
|
||||||
crypto = __nccwpck_require__(6113)
|
crypto = __nccwpck_require__(6113)
|
||||||
const possibleRelevantHashes = ['sha256', 'sha384', 'sha512']
|
|
||||||
supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash))
|
|
||||||
/* c8 ignore next 3 */
|
|
||||||
} catch {
|
} catch {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function responseURL (response) {
|
function responseURL (response) {
|
||||||
|
|
@ -74318,56 +74177,66 @@ function bytesMatch (bytes, metadataList) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. If response is not eligible for integrity validation, return false.
|
// 3. If parsedMetadata is the empty set, return true.
|
||||||
// TODO
|
|
||||||
|
|
||||||
// 4. If parsedMetadata is the empty set, return true.
|
|
||||||
if (parsedMetadata.length === 0) {
|
if (parsedMetadata.length === 0) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Let metadata be the result of getting the strongest
|
// 4. Let metadata be the result of getting the strongest
|
||||||
// metadata from parsedMetadata.
|
// metadata from parsedMetadata.
|
||||||
const strongest = getStrongestMetadata(parsedMetadata)
|
const list = parsedMetadata.sort((c, d) => d.algo.localeCompare(c.algo))
|
||||||
const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest)
|
// get the strongest algorithm
|
||||||
|
const strongest = list[0].algo
|
||||||
|
// get all entries that use the strongest algorithm; ignore weaker
|
||||||
|
const metadata = list.filter((item) => item.algo === strongest)
|
||||||
|
|
||||||
// 6. For each item in metadata:
|
// 5. For each item in metadata:
|
||||||
for (const item of metadata) {
|
for (const item of metadata) {
|
||||||
// 1. Let algorithm be the alg component of item.
|
// 1. Let algorithm be the alg component of item.
|
||||||
const algorithm = item.algo
|
const algorithm = item.algo
|
||||||
|
|
||||||
// 2. Let expectedValue be the val component of item.
|
// 2. Let expectedValue be the val component of item.
|
||||||
const expectedValue = item.hash
|
let expectedValue = item.hash
|
||||||
|
|
||||||
// See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
|
// See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
|
||||||
// "be liberal with padding". This is annoying, and it's not even in the spec.
|
// "be liberal with padding". This is annoying, and it's not even in the spec.
|
||||||
|
|
||||||
|
if (expectedValue.endsWith('==')) {
|
||||||
|
expectedValue = expectedValue.slice(0, -2)
|
||||||
|
}
|
||||||
|
|
||||||
// 3. Let actualValue be the result of applying algorithm to bytes.
|
// 3. Let actualValue be the result of applying algorithm to bytes.
|
||||||
let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64')
|
let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64')
|
||||||
|
|
||||||
if (actualValue[actualValue.length - 1] === '=') {
|
if (actualValue.endsWith('==')) {
|
||||||
if (actualValue[actualValue.length - 2] === '=') {
|
|
||||||
actualValue = actualValue.slice(0, -2)
|
actualValue = actualValue.slice(0, -2)
|
||||||
} else {
|
|
||||||
actualValue = actualValue.slice(0, -1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. If actualValue is a case-sensitive match for expectedValue,
|
// 4. If actualValue is a case-sensitive match for expectedValue,
|
||||||
// return true.
|
// return true.
|
||||||
if (compareBase64Mixed(actualValue, expectedValue)) {
|
if (actualValue === expectedValue) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
let actualBase64URL = crypto.createHash(algorithm).update(bytes).digest('base64url')
|
||||||
|
|
||||||
|
if (actualBase64URL.endsWith('==')) {
|
||||||
|
actualBase64URL = actualBase64URL.slice(0, -2)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actualBase64URL === expectedValue) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7. Return false.
|
// 6. Return false.
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
|
// https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
|
||||||
// https://www.w3.org/TR/CSP2/#source-list-syntax
|
// https://www.w3.org/TR/CSP2/#source-list-syntax
|
||||||
// https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
|
// https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
|
||||||
const parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i
|
const parseHashWithOptions = /((?<algo>sha256|sha384|sha512)-(?<hash>[A-z0-9+/]{1}.*={0,2}))( +[\x21-\x7e]?)?/i
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
|
* @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
|
||||||
|
|
@ -74381,6 +74250,8 @@ function parseMetadata (metadata) {
|
||||||
// 2. Let empty be equal to true.
|
// 2. Let empty be equal to true.
|
||||||
let empty = true
|
let empty = true
|
||||||
|
|
||||||
|
const supportedHashes = crypto.getHashes()
|
||||||
|
|
||||||
// 3. For each token returned by splitting metadata on spaces:
|
// 3. For each token returned by splitting metadata on spaces:
|
||||||
for (const token of metadata.split(' ')) {
|
for (const token of metadata.split(' ')) {
|
||||||
// 1. Set empty to false.
|
// 1. Set empty to false.
|
||||||
|
|
@ -74390,11 +74261,7 @@ function parseMetadata (metadata) {
|
||||||
const parsedToken = parseHashWithOptions.exec(token)
|
const parsedToken = parseHashWithOptions.exec(token)
|
||||||
|
|
||||||
// 3. If token does not parse, continue to the next token.
|
// 3. If token does not parse, continue to the next token.
|
||||||
if (
|
if (parsedToken === null || parsedToken.groups === undefined) {
|
||||||
parsedToken === null ||
|
|
||||||
parsedToken.groups === undefined ||
|
|
||||||
parsedToken.groups.algo === undefined
|
|
||||||
) {
|
|
||||||
// Note: Chromium blocks the request at this point, but Firefox
|
// Note: Chromium blocks the request at this point, but Firefox
|
||||||
// gives a warning that an invalid integrity was given. The
|
// gives a warning that an invalid integrity was given. The
|
||||||
// correct behavior is to ignore these, and subsequently not
|
// correct behavior is to ignore these, and subsequently not
|
||||||
|
|
@ -74403,11 +74270,11 @@ function parseMetadata (metadata) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Let algorithm be the hash-algo component of token.
|
// 4. Let algorithm be the hash-algo component of token.
|
||||||
const algorithm = parsedToken.groups.algo.toLowerCase()
|
const algorithm = parsedToken.groups.algo
|
||||||
|
|
||||||
// 5. If algorithm is a hash function recognized by the user
|
// 5. If algorithm is a hash function recognized by the user
|
||||||
// agent, add the parsed token to result.
|
// agent, add the parsed token to result.
|
||||||
if (supportedHashes.includes(algorithm)) {
|
if (supportedHashes.includes(algorithm.toLowerCase())) {
|
||||||
result.push(parsedToken.groups)
|
result.push(parsedToken.groups)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -74420,82 +74287,6 @@ function parseMetadata (metadata) {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList
|
|
||||||
*/
|
|
||||||
function getStrongestMetadata (metadataList) {
|
|
||||||
// Let algorithm be the algo component of the first item in metadataList.
|
|
||||||
// Can be sha256
|
|
||||||
let algorithm = metadataList[0].algo
|
|
||||||
// If the algorithm is sha512, then it is the strongest
|
|
||||||
// and we can return immediately
|
|
||||||
if (algorithm[3] === '5') {
|
|
||||||
return algorithm
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 1; i < metadataList.length; ++i) {
|
|
||||||
const metadata = metadataList[i]
|
|
||||||
// If the algorithm is sha512, then it is the strongest
|
|
||||||
// and we can break the loop immediately
|
|
||||||
if (metadata.algo[3] === '5') {
|
|
||||||
algorithm = 'sha512'
|
|
||||||
break
|
|
||||||
// If the algorithm is sha384, then a potential sha256 or sha384 is ignored
|
|
||||||
} else if (algorithm[3] === '3') {
|
|
||||||
continue
|
|
||||||
// algorithm is sha256, check if algorithm is sha384 and if so, set it as
|
|
||||||
// the strongest
|
|
||||||
} else if (metadata.algo[3] === '3') {
|
|
||||||
algorithm = 'sha384'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return algorithm
|
|
||||||
}
|
|
||||||
|
|
||||||
function filterMetadataListByAlgorithm (metadataList, algorithm) {
|
|
||||||
if (metadataList.length === 1) {
|
|
||||||
return metadataList
|
|
||||||
}
|
|
||||||
|
|
||||||
let pos = 0
|
|
||||||
for (let i = 0; i < metadataList.length; ++i) {
|
|
||||||
if (metadataList[i].algo === algorithm) {
|
|
||||||
metadataList[pos++] = metadataList[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
metadataList.length = pos
|
|
||||||
|
|
||||||
return metadataList
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compares two base64 strings, allowing for base64url
|
|
||||||
* in the second string.
|
|
||||||
*
|
|
||||||
* @param {string} actualValue always base64
|
|
||||||
* @param {string} expectedValue base64 or base64url
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
function compareBase64Mixed (actualValue, expectedValue) {
|
|
||||||
if (actualValue.length !== expectedValue.length) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
for (let i = 0; i < actualValue.length; ++i) {
|
|
||||||
if (actualValue[i] !== expectedValue[i]) {
|
|
||||||
if (
|
|
||||||
(actualValue[i] === '+' && expectedValue[i] === '-') ||
|
|
||||||
(actualValue[i] === '/' && expectedValue[i] === '_')
|
|
||||||
) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
|
// https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
|
||||||
function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) {
|
function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
@ -74911,8 +74702,7 @@ module.exports = {
|
||||||
urlHasHttpsScheme,
|
urlHasHttpsScheme,
|
||||||
urlIsHttpHttpsScheme,
|
urlIsHttpHttpsScheme,
|
||||||
readAllBytes,
|
readAllBytes,
|
||||||
normalizeMethodRecord,
|
normalizeMethodRecord
|
||||||
parseMetadata
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -76999,17 +76789,12 @@ function parseLocation (statusCode, headers) {
|
||||||
|
|
||||||
// https://tools.ietf.org/html/rfc7231#section-6.4.4
|
// https://tools.ietf.org/html/rfc7231#section-6.4.4
|
||||||
function shouldRemoveHeader (header, removeContent, unknownOrigin) {
|
function shouldRemoveHeader (header, removeContent, unknownOrigin) {
|
||||||
if (header.length === 4) {
|
return (
|
||||||
return util.headerNameToString(header) === 'host'
|
(header.length === 4 && header.toString().toLowerCase() === 'host') ||
|
||||||
}
|
(removeContent && header.toString().toLowerCase().indexOf('content-') === 0) ||
|
||||||
if (removeContent && util.headerNameToString(header).startsWith('content-')) {
|
(unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') ||
|
||||||
return true
|
(unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie')
|
||||||
}
|
)
|
||||||
if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) {
|
|
||||||
const name = util.headerNameToString(header)
|
|
||||||
return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization'
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://tools.ietf.org/html/rfc7231#section-6.4
|
// https://tools.ietf.org/html/rfc7231#section-6.4
|
||||||
|
|
@ -89160,22 +88945,37 @@ async function fetchPatch() {
|
||||||
return ``;
|
return ``;
|
||||||
}
|
}
|
||||||
const ctx = github.context;
|
const ctx = github.context;
|
||||||
if (ctx.eventName !== `pull_request` && ctx.eventName !== `pull_request_target`) {
|
if (ctx.eventName !== `pull_request` && ctx.eventName !== `pull_request_target` && ctx.eventName !== `merge_group`) {
|
||||||
core.info(`Not fetching patch for showing only new issues because it's not a pull request context: event name is ${ctx.eventName}`);
|
core.info(`Not fetching patch for showing only new issues because it's not a pull request context: event name is ${ctx.eventName}`);
|
||||||
return ``;
|
return ``;
|
||||||
}
|
}
|
||||||
const pull = ctx.payload.pull_request;
|
let pullNumber;
|
||||||
if (!pull) {
|
if (ctx.eventName === `merge_group`) {
|
||||||
|
const result = ctx.payload.merge_group.head_ref.match(/pr-(\d+)-/);
|
||||||
|
if (result === null) {
|
||||||
|
core.warning(`No pull request number in merge_group context`);
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
|
pullNumber = parseInt(result[1], 10);
|
||||||
|
}
|
||||||
|
if (ctx.eventName === `pull_request`) {
|
||||||
|
if (!ctx.payload.pull_request) {
|
||||||
core.warning(`No pull request in context`);
|
core.warning(`No pull request in context`);
|
||||||
return ``;
|
return ``;
|
||||||
}
|
}
|
||||||
|
pullNumber = ctx.payload.pull_request.number;
|
||||||
|
}
|
||||||
|
if (pullNumber === undefined) {
|
||||||
|
core.warning(`No pull request number in context`);
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }));
|
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }));
|
||||||
let patch;
|
let patch;
|
||||||
try {
|
try {
|
||||||
const patchResp = await octokit.rest.pulls.get({
|
const patchResp = await octokit.rest.pulls.get({
|
||||||
owner: ctx.repo.owner,
|
owner: ctx.repo.owner,
|
||||||
repo: ctx.repo.repo,
|
repo: ctx.repo.repo,
|
||||||
[`pull_number`]: pull.number,
|
[`pull_number`]: pullNumber,
|
||||||
mediaType: {
|
mediaType: {
|
||||||
format: `diff`,
|
format: `diff`,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
318
dist/run/index.js
generated
vendored
318
dist/run/index.js
generated
vendored
|
|
@ -65683,132 +65683,6 @@ function onConnectTimeout (socket) {
|
||||||
module.exports = buildConnector
|
module.exports = buildConnector
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 4462:
|
|
||||||
/***/ ((module) => {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
|
|
||||||
/** @type {Record<string, string | undefined>} */
|
|
||||||
const headerNameLowerCasedRecord = {}
|
|
||||||
|
|
||||||
// https://developer.mozilla.org/docs/Web/HTTP/Headers
|
|
||||||
const wellknownHeaderNames = [
|
|
||||||
'Accept',
|
|
||||||
'Accept-Encoding',
|
|
||||||
'Accept-Language',
|
|
||||||
'Accept-Ranges',
|
|
||||||
'Access-Control-Allow-Credentials',
|
|
||||||
'Access-Control-Allow-Headers',
|
|
||||||
'Access-Control-Allow-Methods',
|
|
||||||
'Access-Control-Allow-Origin',
|
|
||||||
'Access-Control-Expose-Headers',
|
|
||||||
'Access-Control-Max-Age',
|
|
||||||
'Access-Control-Request-Headers',
|
|
||||||
'Access-Control-Request-Method',
|
|
||||||
'Age',
|
|
||||||
'Allow',
|
|
||||||
'Alt-Svc',
|
|
||||||
'Alt-Used',
|
|
||||||
'Authorization',
|
|
||||||
'Cache-Control',
|
|
||||||
'Clear-Site-Data',
|
|
||||||
'Connection',
|
|
||||||
'Content-Disposition',
|
|
||||||
'Content-Encoding',
|
|
||||||
'Content-Language',
|
|
||||||
'Content-Length',
|
|
||||||
'Content-Location',
|
|
||||||
'Content-Range',
|
|
||||||
'Content-Security-Policy',
|
|
||||||
'Content-Security-Policy-Report-Only',
|
|
||||||
'Content-Type',
|
|
||||||
'Cookie',
|
|
||||||
'Cross-Origin-Embedder-Policy',
|
|
||||||
'Cross-Origin-Opener-Policy',
|
|
||||||
'Cross-Origin-Resource-Policy',
|
|
||||||
'Date',
|
|
||||||
'Device-Memory',
|
|
||||||
'Downlink',
|
|
||||||
'ECT',
|
|
||||||
'ETag',
|
|
||||||
'Expect',
|
|
||||||
'Expect-CT',
|
|
||||||
'Expires',
|
|
||||||
'Forwarded',
|
|
||||||
'From',
|
|
||||||
'Host',
|
|
||||||
'If-Match',
|
|
||||||
'If-Modified-Since',
|
|
||||||
'If-None-Match',
|
|
||||||
'If-Range',
|
|
||||||
'If-Unmodified-Since',
|
|
||||||
'Keep-Alive',
|
|
||||||
'Last-Modified',
|
|
||||||
'Link',
|
|
||||||
'Location',
|
|
||||||
'Max-Forwards',
|
|
||||||
'Origin',
|
|
||||||
'Permissions-Policy',
|
|
||||||
'Pragma',
|
|
||||||
'Proxy-Authenticate',
|
|
||||||
'Proxy-Authorization',
|
|
||||||
'RTT',
|
|
||||||
'Range',
|
|
||||||
'Referer',
|
|
||||||
'Referrer-Policy',
|
|
||||||
'Refresh',
|
|
||||||
'Retry-After',
|
|
||||||
'Sec-WebSocket-Accept',
|
|
||||||
'Sec-WebSocket-Extensions',
|
|
||||||
'Sec-WebSocket-Key',
|
|
||||||
'Sec-WebSocket-Protocol',
|
|
||||||
'Sec-WebSocket-Version',
|
|
||||||
'Server',
|
|
||||||
'Server-Timing',
|
|
||||||
'Service-Worker-Allowed',
|
|
||||||
'Service-Worker-Navigation-Preload',
|
|
||||||
'Set-Cookie',
|
|
||||||
'SourceMap',
|
|
||||||
'Strict-Transport-Security',
|
|
||||||
'Supports-Loading-Mode',
|
|
||||||
'TE',
|
|
||||||
'Timing-Allow-Origin',
|
|
||||||
'Trailer',
|
|
||||||
'Transfer-Encoding',
|
|
||||||
'Upgrade',
|
|
||||||
'Upgrade-Insecure-Requests',
|
|
||||||
'User-Agent',
|
|
||||||
'Vary',
|
|
||||||
'Via',
|
|
||||||
'WWW-Authenticate',
|
|
||||||
'X-Content-Type-Options',
|
|
||||||
'X-DNS-Prefetch-Control',
|
|
||||||
'X-Frame-Options',
|
|
||||||
'X-Permitted-Cross-Domain-Policies',
|
|
||||||
'X-Powered-By',
|
|
||||||
'X-Requested-With',
|
|
||||||
'X-XSS-Protection'
|
|
||||||
]
|
|
||||||
|
|
||||||
for (let i = 0; i < wellknownHeaderNames.length; ++i) {
|
|
||||||
const key = wellknownHeaderNames[i]
|
|
||||||
const lowerCasedKey = key.toLowerCase()
|
|
||||||
headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] =
|
|
||||||
lowerCasedKey
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
|
|
||||||
Object.setPrototypeOf(headerNameLowerCasedRecord, null)
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
wellknownHeaderNames,
|
|
||||||
headerNameLowerCasedRecord
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 8045:
|
/***/ 8045:
|
||||||
|
|
@ -66641,7 +66515,6 @@ const { InvalidArgumentError } = __nccwpck_require__(8045)
|
||||||
const { Blob } = __nccwpck_require__(4300)
|
const { Blob } = __nccwpck_require__(4300)
|
||||||
const nodeUtil = __nccwpck_require__(3837)
|
const nodeUtil = __nccwpck_require__(3837)
|
||||||
const { stringify } = __nccwpck_require__(3477)
|
const { stringify } = __nccwpck_require__(3477)
|
||||||
const { headerNameLowerCasedRecord } = __nccwpck_require__(4462)
|
|
||||||
|
|
||||||
const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
|
const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))
|
||||||
|
|
||||||
|
|
@ -66851,15 +66724,6 @@ function parseKeepAliveTimeout (val) {
|
||||||
return m ? parseInt(m[1], 10) * 1000 : null
|
return m ? parseInt(m[1], 10) * 1000 : null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a header name and returns its lowercase value.
|
|
||||||
* @param {string | Buffer} value Header name
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
function headerNameToString (value) {
|
|
||||||
return headerNameLowerCasedRecord[value] || value.toLowerCase()
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseHeaders (headers, obj = {}) {
|
function parseHeaders (headers, obj = {}) {
|
||||||
// For H2 support
|
// For H2 support
|
||||||
if (!Array.isArray(headers)) return headers
|
if (!Array.isArray(headers)) return headers
|
||||||
|
|
@ -67131,7 +66995,6 @@ module.exports = {
|
||||||
isIterable,
|
isIterable,
|
||||||
isAsyncIterable,
|
isAsyncIterable,
|
||||||
isDestroyed,
|
isDestroyed,
|
||||||
headerNameToString,
|
|
||||||
parseRawHeaders,
|
parseRawHeaders,
|
||||||
parseHeaders,
|
parseHeaders,
|
||||||
parseKeepAliveTimeout,
|
parseKeepAliveTimeout,
|
||||||
|
|
@ -73779,18 +73642,14 @@ const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983
|
||||||
const assert = __nccwpck_require__(9491)
|
const assert = __nccwpck_require__(9491)
|
||||||
const { isUint8Array } = __nccwpck_require__(9830)
|
const { isUint8Array } = __nccwpck_require__(9830)
|
||||||
|
|
||||||
let supportedHashes = []
|
|
||||||
|
|
||||||
// https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
|
// https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
|
||||||
/** @type {import('crypto')|undefined} */
|
/** @type {import('crypto')|undefined} */
|
||||||
let crypto
|
let crypto
|
||||||
|
|
||||||
try {
|
try {
|
||||||
crypto = __nccwpck_require__(6113)
|
crypto = __nccwpck_require__(6113)
|
||||||
const possibleRelevantHashes = ['sha256', 'sha384', 'sha512']
|
|
||||||
supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash))
|
|
||||||
/* c8 ignore next 3 */
|
|
||||||
} catch {
|
} catch {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function responseURL (response) {
|
function responseURL (response) {
|
||||||
|
|
@ -74318,56 +74177,66 @@ function bytesMatch (bytes, metadataList) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. If response is not eligible for integrity validation, return false.
|
// 3. If parsedMetadata is the empty set, return true.
|
||||||
// TODO
|
|
||||||
|
|
||||||
// 4. If parsedMetadata is the empty set, return true.
|
|
||||||
if (parsedMetadata.length === 0) {
|
if (parsedMetadata.length === 0) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Let metadata be the result of getting the strongest
|
// 4. Let metadata be the result of getting the strongest
|
||||||
// metadata from parsedMetadata.
|
// metadata from parsedMetadata.
|
||||||
const strongest = getStrongestMetadata(parsedMetadata)
|
const list = parsedMetadata.sort((c, d) => d.algo.localeCompare(c.algo))
|
||||||
const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest)
|
// get the strongest algorithm
|
||||||
|
const strongest = list[0].algo
|
||||||
|
// get all entries that use the strongest algorithm; ignore weaker
|
||||||
|
const metadata = list.filter((item) => item.algo === strongest)
|
||||||
|
|
||||||
// 6. For each item in metadata:
|
// 5. For each item in metadata:
|
||||||
for (const item of metadata) {
|
for (const item of metadata) {
|
||||||
// 1. Let algorithm be the alg component of item.
|
// 1. Let algorithm be the alg component of item.
|
||||||
const algorithm = item.algo
|
const algorithm = item.algo
|
||||||
|
|
||||||
// 2. Let expectedValue be the val component of item.
|
// 2. Let expectedValue be the val component of item.
|
||||||
const expectedValue = item.hash
|
let expectedValue = item.hash
|
||||||
|
|
||||||
// See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
|
// See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
|
||||||
// "be liberal with padding". This is annoying, and it's not even in the spec.
|
// "be liberal with padding". This is annoying, and it's not even in the spec.
|
||||||
|
|
||||||
|
if (expectedValue.endsWith('==')) {
|
||||||
|
expectedValue = expectedValue.slice(0, -2)
|
||||||
|
}
|
||||||
|
|
||||||
// 3. Let actualValue be the result of applying algorithm to bytes.
|
// 3. Let actualValue be the result of applying algorithm to bytes.
|
||||||
let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64')
|
let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64')
|
||||||
|
|
||||||
if (actualValue[actualValue.length - 1] === '=') {
|
if (actualValue.endsWith('==')) {
|
||||||
if (actualValue[actualValue.length - 2] === '=') {
|
|
||||||
actualValue = actualValue.slice(0, -2)
|
actualValue = actualValue.slice(0, -2)
|
||||||
} else {
|
|
||||||
actualValue = actualValue.slice(0, -1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. If actualValue is a case-sensitive match for expectedValue,
|
// 4. If actualValue is a case-sensitive match for expectedValue,
|
||||||
// return true.
|
// return true.
|
||||||
if (compareBase64Mixed(actualValue, expectedValue)) {
|
if (actualValue === expectedValue) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
let actualBase64URL = crypto.createHash(algorithm).update(bytes).digest('base64url')
|
||||||
|
|
||||||
|
if (actualBase64URL.endsWith('==')) {
|
||||||
|
actualBase64URL = actualBase64URL.slice(0, -2)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actualBase64URL === expectedValue) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7. Return false.
|
// 6. Return false.
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
|
// https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
|
||||||
// https://www.w3.org/TR/CSP2/#source-list-syntax
|
// https://www.w3.org/TR/CSP2/#source-list-syntax
|
||||||
// https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
|
// https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
|
||||||
const parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i
|
const parseHashWithOptions = /((?<algo>sha256|sha384|sha512)-(?<hash>[A-z0-9+/]{1}.*={0,2}))( +[\x21-\x7e]?)?/i
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
|
* @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
|
||||||
|
|
@ -74381,6 +74250,8 @@ function parseMetadata (metadata) {
|
||||||
// 2. Let empty be equal to true.
|
// 2. Let empty be equal to true.
|
||||||
let empty = true
|
let empty = true
|
||||||
|
|
||||||
|
const supportedHashes = crypto.getHashes()
|
||||||
|
|
||||||
// 3. For each token returned by splitting metadata on spaces:
|
// 3. For each token returned by splitting metadata on spaces:
|
||||||
for (const token of metadata.split(' ')) {
|
for (const token of metadata.split(' ')) {
|
||||||
// 1. Set empty to false.
|
// 1. Set empty to false.
|
||||||
|
|
@ -74390,11 +74261,7 @@ function parseMetadata (metadata) {
|
||||||
const parsedToken = parseHashWithOptions.exec(token)
|
const parsedToken = parseHashWithOptions.exec(token)
|
||||||
|
|
||||||
// 3. If token does not parse, continue to the next token.
|
// 3. If token does not parse, continue to the next token.
|
||||||
if (
|
if (parsedToken === null || parsedToken.groups === undefined) {
|
||||||
parsedToken === null ||
|
|
||||||
parsedToken.groups === undefined ||
|
|
||||||
parsedToken.groups.algo === undefined
|
|
||||||
) {
|
|
||||||
// Note: Chromium blocks the request at this point, but Firefox
|
// Note: Chromium blocks the request at this point, but Firefox
|
||||||
// gives a warning that an invalid integrity was given. The
|
// gives a warning that an invalid integrity was given. The
|
||||||
// correct behavior is to ignore these, and subsequently not
|
// correct behavior is to ignore these, and subsequently not
|
||||||
|
|
@ -74403,11 +74270,11 @@ function parseMetadata (metadata) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Let algorithm be the hash-algo component of token.
|
// 4. Let algorithm be the hash-algo component of token.
|
||||||
const algorithm = parsedToken.groups.algo.toLowerCase()
|
const algorithm = parsedToken.groups.algo
|
||||||
|
|
||||||
// 5. If algorithm is a hash function recognized by the user
|
// 5. If algorithm is a hash function recognized by the user
|
||||||
// agent, add the parsed token to result.
|
// agent, add the parsed token to result.
|
||||||
if (supportedHashes.includes(algorithm)) {
|
if (supportedHashes.includes(algorithm.toLowerCase())) {
|
||||||
result.push(parsedToken.groups)
|
result.push(parsedToken.groups)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -74420,82 +74287,6 @@ function parseMetadata (metadata) {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList
|
|
||||||
*/
|
|
||||||
function getStrongestMetadata (metadataList) {
|
|
||||||
// Let algorithm be the algo component of the first item in metadataList.
|
|
||||||
// Can be sha256
|
|
||||||
let algorithm = metadataList[0].algo
|
|
||||||
// If the algorithm is sha512, then it is the strongest
|
|
||||||
// and we can return immediately
|
|
||||||
if (algorithm[3] === '5') {
|
|
||||||
return algorithm
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 1; i < metadataList.length; ++i) {
|
|
||||||
const metadata = metadataList[i]
|
|
||||||
// If the algorithm is sha512, then it is the strongest
|
|
||||||
// and we can break the loop immediately
|
|
||||||
if (metadata.algo[3] === '5') {
|
|
||||||
algorithm = 'sha512'
|
|
||||||
break
|
|
||||||
// If the algorithm is sha384, then a potential sha256 or sha384 is ignored
|
|
||||||
} else if (algorithm[3] === '3') {
|
|
||||||
continue
|
|
||||||
// algorithm is sha256, check if algorithm is sha384 and if so, set it as
|
|
||||||
// the strongest
|
|
||||||
} else if (metadata.algo[3] === '3') {
|
|
||||||
algorithm = 'sha384'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return algorithm
|
|
||||||
}
|
|
||||||
|
|
||||||
function filterMetadataListByAlgorithm (metadataList, algorithm) {
|
|
||||||
if (metadataList.length === 1) {
|
|
||||||
return metadataList
|
|
||||||
}
|
|
||||||
|
|
||||||
let pos = 0
|
|
||||||
for (let i = 0; i < metadataList.length; ++i) {
|
|
||||||
if (metadataList[i].algo === algorithm) {
|
|
||||||
metadataList[pos++] = metadataList[i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
metadataList.length = pos
|
|
||||||
|
|
||||||
return metadataList
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compares two base64 strings, allowing for base64url
|
|
||||||
* in the second string.
|
|
||||||
*
|
|
||||||
* @param {string} actualValue always base64
|
|
||||||
* @param {string} expectedValue base64 or base64url
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
function compareBase64Mixed (actualValue, expectedValue) {
|
|
||||||
if (actualValue.length !== expectedValue.length) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
for (let i = 0; i < actualValue.length; ++i) {
|
|
||||||
if (actualValue[i] !== expectedValue[i]) {
|
|
||||||
if (
|
|
||||||
(actualValue[i] === '+' && expectedValue[i] === '-') ||
|
|
||||||
(actualValue[i] === '/' && expectedValue[i] === '_')
|
|
||||||
) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
|
// https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
|
||||||
function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) {
|
function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
@ -74911,8 +74702,7 @@ module.exports = {
|
||||||
urlHasHttpsScheme,
|
urlHasHttpsScheme,
|
||||||
urlIsHttpHttpsScheme,
|
urlIsHttpHttpsScheme,
|
||||||
readAllBytes,
|
readAllBytes,
|
||||||
normalizeMethodRecord,
|
normalizeMethodRecord
|
||||||
parseMetadata
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -76999,17 +76789,12 @@ function parseLocation (statusCode, headers) {
|
||||||
|
|
||||||
// https://tools.ietf.org/html/rfc7231#section-6.4.4
|
// https://tools.ietf.org/html/rfc7231#section-6.4.4
|
||||||
function shouldRemoveHeader (header, removeContent, unknownOrigin) {
|
function shouldRemoveHeader (header, removeContent, unknownOrigin) {
|
||||||
if (header.length === 4) {
|
return (
|
||||||
return util.headerNameToString(header) === 'host'
|
(header.length === 4 && header.toString().toLowerCase() === 'host') ||
|
||||||
}
|
(removeContent && header.toString().toLowerCase().indexOf('content-') === 0) ||
|
||||||
if (removeContent && util.headerNameToString(header).startsWith('content-')) {
|
(unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') ||
|
||||||
return true
|
(unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie')
|
||||||
}
|
)
|
||||||
if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) {
|
|
||||||
const name = util.headerNameToString(header)
|
|
||||||
return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization'
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://tools.ietf.org/html/rfc7231#section-6.4
|
// https://tools.ietf.org/html/rfc7231#section-6.4
|
||||||
|
|
@ -89160,22 +88945,37 @@ async function fetchPatch() {
|
||||||
return ``;
|
return ``;
|
||||||
}
|
}
|
||||||
const ctx = github.context;
|
const ctx = github.context;
|
||||||
if (ctx.eventName !== `pull_request` && ctx.eventName !== `pull_request_target`) {
|
if (ctx.eventName !== `pull_request` && ctx.eventName !== `pull_request_target` && ctx.eventName !== `merge_group`) {
|
||||||
core.info(`Not fetching patch for showing only new issues because it's not a pull request context: event name is ${ctx.eventName}`);
|
core.info(`Not fetching patch for showing only new issues because it's not a pull request context: event name is ${ctx.eventName}`);
|
||||||
return ``;
|
return ``;
|
||||||
}
|
}
|
||||||
const pull = ctx.payload.pull_request;
|
let pullNumber;
|
||||||
if (!pull) {
|
if (ctx.eventName === `merge_group`) {
|
||||||
|
const result = ctx.payload.merge_group.head_ref.match(/pr-(\d+)-/);
|
||||||
|
if (result === null) {
|
||||||
|
core.warning(`No pull request number in merge_group context`);
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
|
pullNumber = parseInt(result[1], 10);
|
||||||
|
}
|
||||||
|
if (ctx.eventName === `pull_request`) {
|
||||||
|
if (!ctx.payload.pull_request) {
|
||||||
core.warning(`No pull request in context`);
|
core.warning(`No pull request in context`);
|
||||||
return ``;
|
return ``;
|
||||||
}
|
}
|
||||||
|
pullNumber = ctx.payload.pull_request.number;
|
||||||
|
}
|
||||||
|
if (pullNumber === undefined) {
|
||||||
|
core.warning(`No pull request number in context`);
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }));
|
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }));
|
||||||
let patch;
|
let patch;
|
||||||
try {
|
try {
|
||||||
const patchResp = await octokit.rest.pulls.get({
|
const patchResp = await octokit.rest.pulls.get({
|
||||||
owner: ctx.repo.owner,
|
owner: ctx.repo.owner,
|
||||||
repo: ctx.repo.repo,
|
repo: ctx.repo.repo,
|
||||||
[`pull_number`]: pull.number,
|
[`pull_number`]: pullNumber,
|
||||||
mediaType: {
|
mediaType: {
|
||||||
format: `diff`,
|
format: `diff`,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
29
src/run.ts
29
src/run.ts
|
|
@ -32,22 +32,43 @@ async function fetchPatch(): Promise<string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ctx = github.context
|
const ctx = github.context
|
||||||
if (ctx.eventName !== `pull_request` && ctx.eventName !== `pull_request_target`) {
|
if (ctx.eventName !== `pull_request` && ctx.eventName !== `pull_request_target` && ctx.eventName !== `merge_group`) {
|
||||||
core.info(`Not fetching patch for showing only new issues because it's not a pull request context: event name is ${ctx.eventName}`)
|
core.info(`Not fetching patch for showing only new issues because it's not a pull request context: event name is ${ctx.eventName}`)
|
||||||
return ``
|
return ``
|
||||||
}
|
}
|
||||||
const pull = ctx.payload.pull_request
|
|
||||||
if (!pull) {
|
let pullNumber: number | undefined;
|
||||||
|
|
||||||
|
if (ctx.eventName === `merge_group`) {
|
||||||
|
const result = ctx.payload.merge_group.head_ref.match(/pr-(\d+)-/);
|
||||||
|
if (result === null) {
|
||||||
|
core.warning(`No pull request number in merge_group context`)
|
||||||
|
return ``
|
||||||
|
}
|
||||||
|
pullNumber = parseInt(result[1], 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (ctx.eventName === `pull_request`) {
|
||||||
|
if (!ctx.payload.pull_request) {
|
||||||
core.warning(`No pull request in context`)
|
core.warning(`No pull request in context`)
|
||||||
return ``
|
return ``
|
||||||
}
|
}
|
||||||
|
pullNumber = ctx.payload.pull_request.number
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pullNumber === undefined) {
|
||||||
|
core.warning(`No pull request number in context`)
|
||||||
|
return ``
|
||||||
|
}
|
||||||
|
|
||||||
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }))
|
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }))
|
||||||
let patch: string
|
let patch: string
|
||||||
try {
|
try {
|
||||||
const patchResp = await octokit.rest.pulls.get({
|
const patchResp = await octokit.rest.pulls.get({
|
||||||
owner: ctx.repo.owner,
|
owner: ctx.repo.owner,
|
||||||
repo: ctx.repo.repo,
|
repo: ctx.repo.repo,
|
||||||
[`pull_number`]: pull.number,
|
[`pull_number`]: pullNumber,
|
||||||
mediaType: {
|
mediaType: {
|
||||||
format: `diff`,
|
format: `diff`,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue