build: enable JS semicolons (#22783)
This commit is contained in:
parent
24e21467b9
commit
5d657dece4
354 changed files with 21512 additions and 21510 deletions
|
@ -1,18 +1,18 @@
|
|||
const args = require('minimist')(process.argv.slice(2))
|
||||
const octokit = require('@octokit/rest')()
|
||||
const path = require('path')
|
||||
const args = require('minimist')(process.argv.slice(2));
|
||||
const octokit = require('@octokit/rest')();
|
||||
const path = require('path');
|
||||
|
||||
const SOURCE_ROOT = path.normalize(path.dirname(__dirname))
|
||||
const SOURCE_ROOT = path.normalize(path.dirname(__dirname));
|
||||
|
||||
async function checkIfDocOnlyChange () {
|
||||
if (args.prNumber || args.prBranch || args.prURL) {
|
||||
try {
|
||||
let pullRequestNumber = args.prNumber
|
||||
let pullRequestNumber = args.prNumber;
|
||||
if (!pullRequestNumber || isNaN(pullRequestNumber)) {
|
||||
if (args.prURL) {
|
||||
// CircleCI doesn't provide the PR number for branch builds, but it does provide the PR URL
|
||||
const pullRequestParts = args.prURL.split('/')
|
||||
pullRequestNumber = pullRequestParts[pullRequestParts.length - 1]
|
||||
const pullRequestParts = args.prURL.split('/');
|
||||
pullRequestNumber = pullRequestParts[pullRequestParts.length - 1];
|
||||
} else if (args.prBranch) {
|
||||
// AppVeyor doesn't provide a PR number for branch builds - figure it out from the branch
|
||||
const prsForBranch = await octokit.pulls.list({
|
||||
|
@ -20,39 +20,39 @@ async function checkIfDocOnlyChange () {
|
|||
repo: 'electron',
|
||||
state: 'open',
|
||||
head: `electron:${args.prBranch}`
|
||||
})
|
||||
});
|
||||
if (prsForBranch.data.length === 1) {
|
||||
pullRequestNumber = prsForBranch.data[0].number
|
||||
pullRequestNumber = prsForBranch.data[0].number;
|
||||
} else {
|
||||
// If there are 0 PRs or more than one PR on a branch, just assume that this is more than a doc change
|
||||
process.exit(1)
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
const filesChanged = await octokit.pulls.listFiles({
|
||||
owner: 'electron', repo: 'electron', pull_number: pullRequestNumber
|
||||
})
|
||||
});
|
||||
|
||||
const nonDocChange = filesChanged.data.find((fileInfo) => {
|
||||
const fileDirs = fileInfo.filename.split('/')
|
||||
const fileDirs = fileInfo.filename.split('/');
|
||||
if (fileDirs[0] !== 'docs') {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
if (nonDocChange) {
|
||||
process.exit(1)
|
||||
process.exit(1);
|
||||
} else {
|
||||
process.exit(0)
|
||||
process.exit(0);
|
||||
}
|
||||
} catch (ex) {
|
||||
console.error('Error getting list of files changed: ', ex)
|
||||
process.exit(-1)
|
||||
console.error('Error getting list of files changed: ', ex);
|
||||
process.exit(-1);
|
||||
}
|
||||
} else {
|
||||
console.error(`Check if only the docs were changed for a commit.
|
||||
Usage: doc-only-change.js --prNumber=PR_NUMBER || --prBranch=PR_BRANCH || --prURL=PR_URL`)
|
||||
process.exit(-1)
|
||||
Usage: doc-only-change.js --prNumber=PR_NUMBER || --prBranch=PR_BRANCH || --prURL=PR_URL`);
|
||||
process.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
checkIfDocOnlyChange()
|
||||
checkIfDocOnlyChange();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue