diff --git a/dist/index.js b/dist/index.js index f73dfc4..577cf05 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2758,7 +2758,7 @@ class HttpClient { } const usingSsl = parsedUrl.protocol === 'https:'; proxyAgent = new undici_1.ProxyAgent(Object.assign({ uri: proxyUrl.href, pipelining: !this._keepAlive ? 0 : 1 }, ((proxyUrl.username || proxyUrl.password) && { - token: `${proxyUrl.username}:${proxyUrl.password}` + token: `Basic ${Buffer.from(`${proxyUrl.username}:${proxyUrl.password}`).toString('base64')}` }))); this._proxyAgentDispatcher = proxyAgent; if (usingSsl && this._ignoreSslError) { @@ -2872,11 +2872,11 @@ function getProxyUrl(reqUrl) { })(); if (proxyVar) { try { - return new URL(proxyVar); + return new DecodedURL(proxyVar); } catch (_a) { if (!proxyVar.startsWith('http://') && !proxyVar.startsWith('https://')) - return new URL(`http://${proxyVar}`); + return new DecodedURL(`http://${proxyVar}`); } } else { @@ -2935,6 +2935,19 @@ function isLoopbackAddress(host) { hostLower.startsWith('[::1]') || hostLower.startsWith('[0:0:0:0:0:0:0:1]')); } +class DecodedURL extends URL { + constructor(url, base) { + super(url, base); + this._decodedUsername = decodeURIComponent(super.username); + this._decodedPassword = decodeURIComponent(super.password); + } + get username() { + return this._decodedUsername; + } + get password() { + return this._decodedPassword; + } +} //# sourceMappingURL=proxy.js.map /***/ }), @@ -29919,7 +29932,8 @@ var LabelType; LabelType["newCommand"] = "new command"; LabelType["pageEdit"] = "page edit"; LabelType["tooling"] = "tooling"; - LabelType["translation"] = "translation"; + LabelType["newTranslation"] = "new translation"; + LabelType["translationEdit"] = "translation edit"; LabelType["waiting"] = "waiting"; })(LabelType || (exports.LabelType = LabelType = {})); const communityRegex = /^MAINTAINERS\.md$|^\.github\/CODEOWNERS$/; @@ -29970,7 +29984,12 @@ const getFileLabel = (file) => { } } if (translationPageRegex.test(file.filename) || (file.previous_filename && translationPageRegex.test(file.previous_filename))) { - return LabelType.translation; + if (file.status === FileStatus.added) { + return LabelType.newTranslation; + } + if ([FileStatus.modified, FileStatus.removed, FileStatus.renamed].includes(file.status)) { + return LabelType.translationEdit; + } } if (communityRegex.test(file.filename) || (file.previous_filename && communityRegex.test(file.previous_filename))) { return LabelType.community; diff --git a/src/labeler.spec.ts b/src/labeler.spec.ts index 354874f..a8fba17 100644 --- a/src/labeler.spec.ts +++ b/src/labeler.spec.ts @@ -26,17 +26,25 @@ describe('getFileLabel', () => { }); describe('when a translation page is changed', () => { + describe('and the status is added', () => { + it('should return new command label', () => { + expect(getFileLabel({ + filename: 'pages.de/common/git.md', + status: FileStatus.added, + })).toBe(LabelType.newTranslation); + }); + }); + describe.each([ - FileStatus.added, FileStatus.modified, FileStatus.removed, - FileStatus.renamed + FileStatus.renamed, ])('and the status is %s', (status: FileStatus) => { - it('should return translation label', () => { + it('should return translation edit label', () => { expect(getFileLabel({ filename: 'pages.de/common/git.md', status, - })).toBe(LabelType.translation); + })).toBe(LabelType.translationEdit); }); }); }); diff --git a/src/labeler.ts b/src/labeler.ts index 812d28e..044d950 100644 --- a/src/labeler.ts +++ b/src/labeler.ts @@ -18,7 +18,8 @@ export enum LabelType { newCommand = 'new command', pageEdit = 'page edit', tooling = 'tooling', - translation = 'translation', + newTranslation = 'new translation', + translationEdit = 'translation edit', waiting = 'waiting', } @@ -105,7 +106,12 @@ export const getFileLabel = (file: PrFile): string|null => { } } if (translationPageRegex.test(file.filename) || (file.previous_filename && translationPageRegex.test(file.previous_filename))) { - return LabelType.translation; + if (file.status === FileStatus.added) { + return LabelType.newTranslation; + } + if ([FileStatus.modified, FileStatus.removed, FileStatus.renamed].includes(file.status)) { + return LabelType.translationEdit; + } } if (communityRegex.test(file.filename) || (file.previous_filename && communityRegex.test(file.previous_filename))) { return LabelType.community; diff --git a/src/util.spec.ts b/src/util.spec.ts index 6f28b77..06f8756 100644 --- a/src/util.spec.ts +++ b/src/util.spec.ts @@ -3,7 +3,7 @@ import {uniq} from './util'; describe('uniq', () => { it('should return an array with unique values', () => { - const unique = uniq([LabelType.newCommand, LabelType.newCommand, LabelType.translation]); - expect(unique).toEqual([LabelType.newCommand, LabelType.translation]); + const unique = uniq([LabelType.newCommand, LabelType.newCommand, LabelType.newTranslation]); + expect(unique).toEqual([LabelType.newCommand, LabelType.newTranslation]); }); });