This commit is contained in:
GrantBirki 2023-11-07 16:15:14 -07:00
Родитель 6c193bb22a
Коммит 3046b44217
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9029BBCCC15C6F8C
7 изменённых файлов: 90 добавлений и 90 удалений

30
dist/index.js сгенерированный поставляемый
Просмотреть файл

@ -33952,7 +33952,7 @@ function getUserAgent() {
return navigator.userAgent;
}
if (typeof process === "object" && "version" in process) {
if (typeof process === "object" && process.version !== undefined) {
return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`;
}
@ -36982,7 +36982,7 @@ class GitHubProvider {
owner: github.context.repo.owner,
repo: github.context.repo.repo,
issue_number: prNumber,
}
},
);
return prLabels;
}
@ -37013,7 +37013,7 @@ class PrivilegedRequester {
this.requesters = this.configContents["requesters"];
} catch (err) {
lib_core.error(
`There was a problem with the privileged requester configuration.\n${err}\n${err.stack}`
`There was a problem with the privileged requester configuration.\n${err}\n${err.stack}`,
);
lib_core.setFailed(err.message);
return false;
@ -37087,27 +37087,27 @@ class Runner {
async processCommits(privileged_requester_username) {
// Check all commits of the PR to verify that they are all from the privileged requester, otherwise return from the check
lib_core.info(
`Commits: Comparing the PR commits to verify that they are all from ${privileged_requester_username}`
`Commits: Comparing the PR commits to verify that they are all from ${privileged_requester_username}`,
);
for (const [, commit] of Object.entries(this.pullRequest.listCommits())) {
let commitAuthor = commit.author.login.toLowerCase();
if (commitAuthor !== privileged_requester_username) {
lib_core.warning(
`Unexpected commit author found by ${commitAuthor}! Commits should be authored by ${privileged_requester_username} I will not proceed with the privileged reviewer process.`
`Unexpected commit author found by ${commitAuthor}! Commits should be authored by ${privileged_requester_username} I will not proceed with the privileged reviewer process.`,
);
return false;
}
}
lib_core.info(
`Commits: All commits are made by ${privileged_requester_username}. Success!`
`Commits: All commits are made by ${privileged_requester_username}. Success!`,
);
return true;
}
async processDiff() {
lib_core.info(
`Diff: Checking the access diff to verify that there are only removals`
`Diff: Checking the access diff to verify that there are only removals`,
);
let diff = await this.pullRequest.getDiff();
let diffArray = diff.split("\n");
@ -37118,7 +37118,7 @@ class Runner {
}
if (diffLine.startsWith("+")) {
lib_core.warning(
`Diff: This PR includes additions which are not allowed with the checkDiff option`
`Diff: This PR includes additions which are not allowed with the checkDiff option`,
);
return false;
}
@ -37155,19 +37155,19 @@ class Runner {
}
lib_core.info(
`Labels: Comparing the PR Labels: ${prLabelArray} with the privileged requester labels: ${privileged_requester_config.labels}`
`Labels: Comparing the PR Labels: ${prLabelArray} with the privileged requester labels: ${privileged_requester_config.labels}`,
);
if (
this.labelsEqual(prLabelArray, privileged_requester_config.labels) ===
false
) {
lib_core.warning(
`Labels: Invalid label(s) found. I will not proceed with the privileged reviewer process.`
`Labels: Invalid label(s) found. I will not proceed with the privileged reviewer process.`,
);
return false;
}
lib_core.info(
`Labels: Labels on the PR match those in the privileged reviewer config. Success!`
`Labels: Labels on the PR match those in the privileged reviewer config. Success!`,
);
return true;
}
@ -37185,24 +37185,24 @@ class Runner {
// If privileged_requester_username is not the creator of the PR, move on
// If privileged_requester_username is the creator of the PR, check the remaining config
lib_core.info(
`PR creator is ${this.pullRequest.prCreator}. Testing against ${privileged_requester_username}`
`PR creator is ${this.pullRequest.prCreator}. Testing against ${privileged_requester_username}`,
);
if (this.pullRequest.prCreator !== privileged_requester_username) {
continue;
}
await this.processPrivilegedReviewer(
privileged_requester_username,
privileged_requester_config
privileged_requester_config,
);
}
}
async processPrivilegedReviewer(
privileged_requester_username,
privileged_requester_config
privileged_requester_config,
) {
lib_core.info(
`Privileged requester ${privileged_requester_username} found. Checking PR criteria against the privileged requester configuration.`
`Privileged requester ${privileged_requester_username} found. Checking PR criteria against the privileged requester configuration.`,
);
this.checkCommits = lib_core.getInput("checkCommits");

2
dist/index.js.map сгенерированный поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

106
package-lock.json сгенерированный
Просмотреть файл

@ -14,13 +14,13 @@
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@babel/plugin-proposal-throw-expressions": "^7.18.6",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@vercel/ncc": "^0.38.0",
"eslint": "^8.25.0",
"jest": "^29.2.0",
"nock": "^13.2.9",
"prettier": "^2.7.1"
"@babel/plugin-proposal-throw-expressions": "^7.22.5",
"@babel/plugin-transform-modules-commonjs": "^7.23.0",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.53.0",
"jest": "^29.7.0",
"nock": "^13.3.8",
"prettier": "^3.0.3"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@ -627,9 +627,9 @@
}
},
"node_modules/@eslint/eslintrc": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz",
"integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==",
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz",
"integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
@ -677,9 +677,9 @@
}
},
"node_modules/@eslint/js": {
"version": "8.51.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz",
"integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==",
"version": "8.53.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.53.0.tgz",
"integrity": "sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -694,12 +694,12 @@
}
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.11",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz",
"integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==",
"version": "0.11.13",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz",
"integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==",
"dev": true,
"dependencies": {
"@humanwhocodes/object-schema": "^1.2.1",
"@humanwhocodes/object-schema": "^2.0.1",
"debug": "^4.1.1",
"minimatch": "^3.0.5"
},
@ -721,9 +721,9 @@
}
},
"node_modules/@humanwhocodes/object-schema": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz",
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
"dev": true
},
"node_modules/@istanbuljs/load-nyc-config": {
@ -1774,19 +1774,25 @@
"integrity": "sha512-axdPBuLuEJt0c4yI5OZssC19K2Mq1uKdrfZBzuxLvaztgqUtFYZUNw7lETExPYJR9jdEoIg4mb7RQKRQzOkeGQ==",
"dev": true
},
"node_modules/@ungap/structured-clone": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
"dev": true
},
"node_modules/@vercel/ncc": {
"version": "0.38.0",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.0.tgz",
"integrity": "sha512-B4YKZMm/EqMptKSFyAq4q2SlgJe+VCmEH6Y8gf/E1pTlWbsUJpuH1ymik2Ex3aYO5mCWwV1kaSYHSQOT8+4vHA==",
"version": "0.38.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz",
"integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
}
},
"node_modules/acorn": {
"version": "8.10.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
"integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==",
"version": "8.11.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
"integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
"dev": true,
"bin": {
"acorn": "bin/acorn"
@ -2508,18 +2514,19 @@
}
},
"node_modules/eslint": {
"version": "8.51.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz",
"integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==",
"version": "8.53.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.53.0.tgz",
"integrity": "sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2",
"@eslint/js": "8.51.0",
"@humanwhocodes/config-array": "^0.11.11",
"@eslint/eslintrc": "^2.1.3",
"@eslint/js": "8.53.0",
"@humanwhocodes/config-array": "^0.11.13",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"@ungap/structured-clone": "^1.2.0",
"ajv": "^6.12.4",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@ -5058,12 +5065,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@ -5189,14 +5190,13 @@
"dev": true
},
"node_modules/nock": {
"version": "13.3.4",
"resolved": "https://registry.npmjs.org/nock/-/nock-13.3.4.tgz",
"integrity": "sha512-DDpmn5oLEdCTclEqweOT4U7bEpuoifBMFUXem9sA4turDAZ5tlbrEoWqCorwXey8CaAw44mst5JOQeVNiwtkhw==",
"version": "13.3.8",
"resolved": "https://registry.npmjs.org/nock/-/nock-13.3.8.tgz",
"integrity": "sha512-96yVFal0c/W1lG7mmfRe7eO+hovrhJYd2obzzOZ90f6fjpeU/XNvd9cYHZKZAQJumDfhXgoTpkpJ9pvMj+hqHw==",
"dev": true,
"dependencies": {
"debug": "^4.1.0",
"json-stringify-safe": "^5.0.1",
"lodash": "^4.17.21",
"propagate": "^2.0.0"
},
"engines": {
@ -5498,15 +5498,15 @@
}
},
"node_modules/prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz",
"integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=10.13.0"
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
@ -5561,9 +5561,9 @@
}
},
"node_modules/punycode": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
"integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"dev": true,
"engines": {
"node": ">=6"
@ -6025,9 +6025,9 @@
"dev": true
},
"node_modules/universal-user-agent": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
"integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ=="
},
"node_modules/update-browserslist-db": {
"version": "1.0.13",

Просмотреть файл

@ -35,12 +35,12 @@
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@babel/plugin-proposal-throw-expressions": "^7.18.6",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@vercel/ncc": "^0.38.0",
"eslint": "^8.25.0",
"jest": "^29.2.0",
"nock": "^13.2.9",
"prettier": "^2.7.1"
"@babel/plugin-proposal-throw-expressions": "^7.22.5",
"@babel/plugin-transform-modules-commonjs": "^7.23.0",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.53.0",
"jest": "^29.7.0",
"nock": "^13.3.8",
"prettier": "^3.0.3"
}
}

Просмотреть файл

@ -63,7 +63,7 @@ class GitHubProvider {
owner: github.context.repo.owner,
repo: github.context.repo.repo,
issue_number: prNumber,
}
},
);
return prLabels;
}

Просмотреть файл

@ -20,7 +20,7 @@ class PrivilegedRequester {
this.requesters = this.configContents["requesters"];
} catch (err) {
core.error(
`There was a problem with the privileged requester configuration.\n${err}\n${err.stack}`
`There was a problem with the privileged requester configuration.\n${err}\n${err.stack}`,
);
core.setFailed(err.message);
return false;

Просмотреть файл

@ -11,27 +11,27 @@ class Runner {
async processCommits(privileged_requester_username) {
// Check all commits of the PR to verify that they are all from the privileged requester, otherwise return from the check
core.info(
`Commits: Comparing the PR commits to verify that they are all from ${privileged_requester_username}`
`Commits: Comparing the PR commits to verify that they are all from ${privileged_requester_username}`,
);
for (const [, commit] of Object.entries(this.pullRequest.listCommits())) {
let commitAuthor = commit.author.login.toLowerCase();
if (commitAuthor !== privileged_requester_username) {
core.warning(
`Unexpected commit author found by ${commitAuthor}! Commits should be authored by ${privileged_requester_username} I will not proceed with the privileged reviewer process.`
`Unexpected commit author found by ${commitAuthor}! Commits should be authored by ${privileged_requester_username} I will not proceed with the privileged reviewer process.`,
);
return false;
}
}
core.info(
`Commits: All commits are made by ${privileged_requester_username}. Success!`
`Commits: All commits are made by ${privileged_requester_username}. Success!`,
);
return true;
}
async processDiff() {
core.info(
`Diff: Checking the access diff to verify that there are only removals`
`Diff: Checking the access diff to verify that there are only removals`,
);
let diff = await this.pullRequest.getDiff();
let diffArray = diff.split("\n");
@ -42,7 +42,7 @@ class Runner {
}
if (diffLine.startsWith("+")) {
core.warning(
`Diff: This PR includes additions which are not allowed with the checkDiff option`
`Diff: This PR includes additions which are not allowed with the checkDiff option`,
);
return false;
}
@ -79,19 +79,19 @@ class Runner {
}
core.info(
`Labels: Comparing the PR Labels: ${prLabelArray} with the privileged requester labels: ${privileged_requester_config.labels}`
`Labels: Comparing the PR Labels: ${prLabelArray} with the privileged requester labels: ${privileged_requester_config.labels}`,
);
if (
this.labelsEqual(prLabelArray, privileged_requester_config.labels) ===
false
) {
core.warning(
`Labels: Invalid label(s) found. I will not proceed with the privileged reviewer process.`
`Labels: Invalid label(s) found. I will not proceed with the privileged reviewer process.`,
);
return false;
}
core.info(
`Labels: Labels on the PR match those in the privileged reviewer config. Success!`
`Labels: Labels on the PR match those in the privileged reviewer config. Success!`,
);
return true;
}
@ -109,24 +109,24 @@ class Runner {
// If privileged_requester_username is not the creator of the PR, move on
// If privileged_requester_username is the creator of the PR, check the remaining config
core.info(
`PR creator is ${this.pullRequest.prCreator}. Testing against ${privileged_requester_username}`
`PR creator is ${this.pullRequest.prCreator}. Testing against ${privileged_requester_username}`,
);
if (this.pullRequest.prCreator !== privileged_requester_username) {
continue;
}
await this.processPrivilegedReviewer(
privileged_requester_username,
privileged_requester_config
privileged_requester_config,
);
}
}
async processPrivilegedReviewer(
privileged_requester_username,
privileged_requester_config
privileged_requester_config,
) {
core.info(
`Privileged requester ${privileged_requester_username} found. Checking PR criteria against the privileged requester configuration.`
`Privileged requester ${privileged_requester_username} found. Checking PR criteria against the privileged requester configuration.`,
);
this.checkCommits = core.getInput("checkCommits");