mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-01 01:13:17 +08:00
octokit client should follow proxy settings (#314)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as assert from 'assert'
|
||||
import * as path from 'path'
|
||||
import assert from 'assert'
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as assert from 'assert'
|
||||
import * as path from 'path'
|
||||
import * as pathHelper from './internal-path-helper'
|
||||
import assert from 'assert'
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as assert from 'assert'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import * as pathHelper from './internal-path-helper'
|
||||
import assert from 'assert'
|
||||
import {Minimatch, IMinimatch, IOptions as IMinimatchOptions} from 'minimatch'
|
||||
import {MatchKind} from './internal-match-kind'
|
||||
import {Path} from './internal-path'
|
||||
@@ -48,8 +48,13 @@ export class Pattern {
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/291
|
||||
|
||||
constructor(pattern: string)
|
||||
constructor(pattern: string, segments: undefined, homedir: string)
|
||||
constructor(negate: boolean, segments: string[])
|
||||
constructor(patternOrNegate: string | boolean, segments?: string[]) {
|
||||
constructor(
|
||||
patternOrNegate: string | boolean,
|
||||
segments?: string[],
|
||||
homedir?: string
|
||||
) {
|
||||
// Pattern overload
|
||||
let pattern: string
|
||||
if (typeof patternOrNegate === 'string') {
|
||||
@@ -78,7 +83,7 @@ export class Pattern {
|
||||
}
|
||||
|
||||
// Normalize slashes and ensures absolute root
|
||||
pattern = Pattern.fixupPattern(pattern)
|
||||
pattern = Pattern.fixupPattern(pattern, homedir)
|
||||
|
||||
// Segments
|
||||
this.segments = new Path(pattern).segments
|
||||
@@ -177,7 +182,7 @@ export class Pattern {
|
||||
/**
|
||||
* Normalizes slashes and ensures absolute root
|
||||
*/
|
||||
private static fixupPattern(pattern: string): string {
|
||||
private static fixupPattern(pattern: string, homedir?: string): string {
|
||||
// Empty
|
||||
assert(pattern, 'pattern cannot be empty')
|
||||
|
||||
@@ -206,7 +211,7 @@ export class Pattern {
|
||||
}
|
||||
// Replace leading `~` segment
|
||||
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
|
||||
const homedir = os.homedir()
|
||||
homedir = homedir || os.homedir()
|
||||
assert(homedir, 'Unable to determine HOME directory')
|
||||
assert(
|
||||
pathHelper.hasAbsoluteRoot(homedir),
|
||||
|
||||
Reference in New Issue
Block a user