remove: unused code (#2014)
This commit is contained in:
parent
2ca8dc42f6
commit
90941b398f
94
dist/index.js
generated
vendored
94
dist/index.js
generated
vendored
@ -1107,8 +1107,8 @@ const getSHAForNonPullRequestEvent = (_j) => __awaiter(void 0, [_j], void 0, fun
|
||||
};
|
||||
});
|
||||
exports.getSHAForNonPullRequestEvent = getSHAForNonPullRequestEvent;
|
||||
const getSHAForPullRequestEvent = (_o) => __awaiter(void 0, [_o], void 0, function* ({ inputs, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs, remoteName, isFork }) {
|
||||
var _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
||||
const getSHAForPullRequestEvent = (_o) => __awaiter(void 0, [_o], void 0, function* ({ inputs, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs, remoteName }) {
|
||||
var _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
||||
let targetBranch = (_q = (_p = github.context.payload.pull_request) === null || _p === void 0 ? void 0 : _p.base) === null || _q === void 0 ? void 0 : _q.ref;
|
||||
const currentBranch = (_s = (_r = github.context.payload.pull_request) === null || _r === void 0 ? void 0 : _r.head) === null || _s === void 0 ? void 0 : _s.ref;
|
||||
if (inputs.sinceLastRemoteCommit) {
|
||||
@ -1247,18 +1247,13 @@ const getSHAForPullRequestEvent = (_o) => __awaiter(void 0, [_o], void 0, functi
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (github.context.payload.action === 'closed' || isFork) {
|
||||
previousSha = (_x = (_w = github.context.payload.pull_request) === null || _w === void 0 ? void 0 : _w.base) === null || _x === void 0 ? void 0 : _x.sha;
|
||||
}
|
||||
else {
|
||||
previousSha = (_x = (_w = github.context.payload.pull_request) === null || _w === void 0 ? void 0 : _w.base) === null || _x === void 0 ? void 0 : _x.sha;
|
||||
if (!previousSha) {
|
||||
previousSha = yield (0, utils_1.getRemoteBranchHeadSha)({
|
||||
cwd: workingDirectory,
|
||||
branch: targetBranch,
|
||||
remoteName
|
||||
remoteName,
|
||||
branch: targetBranch
|
||||
});
|
||||
if (!previousSha) {
|
||||
previousSha = (_z = (_y = github.context.payload.pull_request) === null || _y === void 0 ? void 0 : _y.base) === null || _z === void 0 ? void 0 : _z.sha;
|
||||
}
|
||||
}
|
||||
if (isShallow) {
|
||||
if (!(yield (0, utils_1.canDiffCommits)({
|
||||
@ -1295,7 +1290,7 @@ const getSHAForPullRequestEvent = (_o) => __awaiter(void 0, [_o], void 0, functi
|
||||
}
|
||||
}
|
||||
if (!previousSha || previousSha === currentSha) {
|
||||
previousSha = (_1 = (_0 = github.context.payload.pull_request) === null || _0 === void 0 ? void 0 : _0.base) === null || _1 === void 0 ? void 0 : _1.sha;
|
||||
previousSha = (_z = (_y = github.context.payload.pull_request) === null || _y === void 0 ? void 0 : _y.base) === null || _z === void 0 ? void 0 : _z.sha;
|
||||
}
|
||||
}
|
||||
if (!(yield (0, utils_1.canDiffCommits)({
|
||||
@ -1714,7 +1709,7 @@ const env_1 = __nccwpck_require__(9763);
|
||||
const inputs_1 = __nccwpck_require__(6180);
|
||||
const utils_1 = __nccwpck_require__(918);
|
||||
const getChangedFilesFromLocalGitHistory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ inputs, env, workingDirectory, filePatterns, yamlFilePatterns }) {
|
||||
var _b, _c, _d, _e;
|
||||
var _b, _c, _d;
|
||||
yield (0, utils_1.verifyMinimumGitVersion)();
|
||||
let quotepathValue = 'on';
|
||||
if (!inputs.quotepath) {
|
||||
@ -1737,8 +1732,7 @@ const getChangedFilesFromLocalGitHistory = (_a) => __awaiter(void 0, [_a], void
|
||||
gitFetchExtraArgs.push('--recurse-submodules');
|
||||
}
|
||||
const isTag = (_b = env.GITHUB_REF) === null || _b === void 0 ? void 0 : _b.startsWith('refs/tags/');
|
||||
const isFork = ((_c = github.context.payload.pull_request) === null || _c === void 0 ? void 0 : _c.head.repo.fork) || false;
|
||||
let remoteName = 'origin';
|
||||
const remoteName = 'origin';
|
||||
const outputRenamedFilesAsDeletedAndAdded = inputs.outputRenamedFilesAsDeletedAndAdded;
|
||||
let submodulePaths = [];
|
||||
if (hasSubmodule) {
|
||||
@ -1747,11 +1741,8 @@ const getChangedFilesFromLocalGitHistory = (_a) => __awaiter(void 0, [_a], void
|
||||
if (isTag) {
|
||||
gitFetchExtraArgs = ['--prune', '--no-recurse-submodules'];
|
||||
}
|
||||
if (isFork) {
|
||||
remoteName = yield (0, utils_1.setForkRemote)({ cwd: workingDirectory });
|
||||
}
|
||||
let diffResult;
|
||||
if (!((_e = (_d = github.context.payload.pull_request) === null || _d === void 0 ? void 0 : _d.base) === null || _e === void 0 ? void 0 : _e.ref)) {
|
||||
if (!((_d = (_c = github.context.payload.pull_request) === null || _c === void 0 ? void 0 : _c.base) === null || _d === void 0 ? void 0 : _d.ref)) {
|
||||
core.info(`Running on a ${github.context.eventName || 'push'} event...`);
|
||||
diffResult = yield (0, commitSha_1.getSHAForNonPullRequestEvent)({
|
||||
inputs,
|
||||
@ -1772,8 +1763,7 @@ const getChangedFilesFromLocalGitHistory = (_a) => __awaiter(void 0, [_a], void
|
||||
isShallow,
|
||||
hasSubmodule,
|
||||
gitFetchExtraArgs,
|
||||
remoteName,
|
||||
isFork
|
||||
remoteName
|
||||
});
|
||||
}
|
||||
if (diffResult.initialCommit) {
|
||||
@ -1847,7 +1837,7 @@ const getChangedFilesFromLocalGitHistory = (_a) => __awaiter(void 0, [_a], void
|
||||
core.endGroup();
|
||||
}
|
||||
});
|
||||
const getChangedFilesFromRESTAPI = (_f) => __awaiter(void 0, [_f], void 0, function* ({ inputs, filePatterns, yamlFilePatterns }) {
|
||||
const getChangedFilesFromRESTAPI = (_e) => __awaiter(void 0, [_e], void 0, function* ({ inputs, filePatterns, yamlFilePatterns }) {
|
||||
const allDiffFiles = yield (0, changedFiles_1.getChangedFilesFromGithubAPI)({
|
||||
inputs
|
||||
});
|
||||
@ -1986,7 +1976,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.warnUnsupportedRESTAPIInputs = exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.setArrayOutput = exports.getOutputKey = exports.getRecoverFilePatterns = exports.getYamlFilePatterns = exports.getFilePatterns = exports.getDirNamesIncludeFilesPattern = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.cleanShaInput = exports.verifyCommitSha = exports.setForkRemote = exports.getParentSha = exports.getCurrentBranchName = exports.getRemoteBranchHeadSha = exports.isInsideWorkTree = exports.getHeadSha = exports.gitLog = exports.getFilteredChangedFiles = exports.getAllChangedFiles = exports.gitRenamedFiles = exports.gitSubmoduleDiffSHA = exports.getSubmodulePath = exports.gitFetchSubmodules = exports.gitFetch = exports.submoduleExists = exports.isRepoShallow = exports.updateGitGlobalConfig = exports.exists = exports.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0;
|
||||
exports.warnUnsupportedRESTAPIInputs = exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.setArrayOutput = exports.getOutputKey = exports.getRecoverFilePatterns = exports.getYamlFilePatterns = exports.getFilePatterns = exports.getDirNamesIncludeFilesPattern = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.cleanShaInput = exports.verifyCommitSha = exports.getParentSha = exports.getCurrentBranchName = exports.getRemoteBranchHeadSha = exports.isInsideWorkTree = exports.getHeadSha = exports.gitLog = exports.getFilteredChangedFiles = exports.getAllChangedFiles = exports.gitRenamedFiles = exports.gitSubmoduleDiffSHA = exports.getSubmodulePath = exports.gitFetchSubmodules = exports.gitFetch = exports.submoduleExists = exports.isRepoShallow = exports.updateGitGlobalConfig = exports.exists = exports.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0;
|
||||
/*global AsyncIterableIterator*/
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
@ -2522,33 +2512,7 @@ const getParentSha = (_3) => __awaiter(void 0, [_3], void 0, function* ({ cwd })
|
||||
return stdout.trim();
|
||||
});
|
||||
exports.getParentSha = getParentSha;
|
||||
const remoteExists = (cwd, remoteName) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { exitCode } = yield exec.getExecOutput('git', ['remote', 'get-url', remoteName], {
|
||||
cwd,
|
||||
ignoreReturnCode: true,
|
||||
silent: !core.isDebug()
|
||||
});
|
||||
return exitCode === 0;
|
||||
});
|
||||
const setForkRemote = (_4) => __awaiter(void 0, [_4], void 0, function* ({ cwd }) {
|
||||
var _5;
|
||||
const remoteName = 'changed-files-fork';
|
||||
const remoteFound = yield remoteExists(cwd, remoteName);
|
||||
if (!remoteFound) {
|
||||
yield exec.getExecOutput('git', [
|
||||
'remote',
|
||||
'add',
|
||||
remoteName,
|
||||
(_5 = github.context.payload.repository) === null || _5 === void 0 ? void 0 : _5.clone_url
|
||||
], {
|
||||
cwd,
|
||||
silent: !core.isDebug()
|
||||
});
|
||||
}
|
||||
return remoteName;
|
||||
});
|
||||
exports.setForkRemote = setForkRemote;
|
||||
const verifyCommitSha = (_6) => __awaiter(void 0, [_6], void 0, function* ({ sha, cwd, showAsErrorMessage = true }) {
|
||||
const verifyCommitSha = (_4) => __awaiter(void 0, [_4], void 0, function* ({ sha, cwd, showAsErrorMessage = true }) {
|
||||
const { exitCode, stderr } = yield exec.getExecOutput('git', ['rev-parse', '--verify', `${sha}^{commit}`], {
|
||||
cwd,
|
||||
ignoreReturnCode: true,
|
||||
@ -2580,7 +2544,7 @@ exports.verifyCommitSha = verifyCommitSha;
|
||||
* @param token The GitHub token.
|
||||
* @returns The cleaned SHA string.
|
||||
*/
|
||||
const cleanShaInput = (_7) => __awaiter(void 0, [_7], void 0, function* ({ sha, cwd, token }) {
|
||||
const cleanShaInput = (_5) => __awaiter(void 0, [_5], void 0, function* ({ sha, cwd, token }) {
|
||||
// Check if the input is a valid commit sha
|
||||
if (!sha) {
|
||||
return sha;
|
||||
@ -2604,7 +2568,7 @@ const cleanShaInput = (_7) => __awaiter(void 0, [_7], void 0, function* ({ sha,
|
||||
return stdout.trim();
|
||||
});
|
||||
exports.cleanShaInput = cleanShaInput;
|
||||
const getPreviousGitTag = (_8) => __awaiter(void 0, [_8], void 0, function* ({ cwd }) {
|
||||
const getPreviousGitTag = (_6) => __awaiter(void 0, [_6], void 0, function* ({ cwd }) {
|
||||
const { stdout } = yield exec.getExecOutput('git', ['tag', '--sort=-creatordate'], {
|
||||
cwd,
|
||||
silent: !core.isDebug()
|
||||
@ -2623,7 +2587,7 @@ const getPreviousGitTag = (_8) => __awaiter(void 0, [_8], void 0, function* ({ c
|
||||
return { tag: previousTag, sha };
|
||||
});
|
||||
exports.getPreviousGitTag = getPreviousGitTag;
|
||||
const canDiffCommits = (_9) => __awaiter(void 0, [_9], void 0, function* ({ cwd, sha1, sha2, diff }) {
|
||||
const canDiffCommits = (_7) => __awaiter(void 0, [_7], void 0, function* ({ cwd, sha1, sha2, diff }) {
|
||||
if (diff === '...') {
|
||||
const mergeBase = yield getMergeBase(cwd, sha1, sha2);
|
||||
if (!mergeBase) {
|
||||
@ -2690,7 +2654,7 @@ const getDirNamesIncludeFilesPattern = ({ inputs }) => {
|
||||
.filter(Boolean);
|
||||
};
|
||||
exports.getDirNamesIncludeFilesPattern = getDirNamesIncludeFilesPattern;
|
||||
const getFilePatterns = (_10) => __awaiter(void 0, [_10], void 0, function* ({ inputs, workingDirectory }) {
|
||||
const getFilePatterns = (_8) => __awaiter(void 0, [_8], void 0, function* ({ inputs, workingDirectory }) {
|
||||
let cleanedFilePatterns = [];
|
||||
if (inputs.files) {
|
||||
const filesPatterns = inputs.files
|
||||
@ -2757,7 +2721,7 @@ const getFilePatterns = (_10) => __awaiter(void 0, [_10], void 0, function* ({ i
|
||||
return cleanedFilePatterns;
|
||||
});
|
||||
exports.getFilePatterns = getFilePatterns;
|
||||
const getYamlFilePatternsFromContents = (_11) => __awaiter(void 0, [_11], void 0, function* ({ content = '', filePath = '', excludedFiles = false }) {
|
||||
const getYamlFilePatternsFromContents = (_9) => __awaiter(void 0, [_9], void 0, function* ({ content = '', filePath = '', excludedFiles = false }) {
|
||||
const filePatterns = {};
|
||||
let source = '';
|
||||
if (filePath) {
|
||||
@ -2814,7 +2778,7 @@ const getYamlFilePatternsFromContents = (_11) => __awaiter(void 0, [_11], void 0
|
||||
}
|
||||
return filePatterns;
|
||||
});
|
||||
const getYamlFilePatterns = (_12) => __awaiter(void 0, [_12], void 0, function* ({ inputs, workingDirectory }) {
|
||||
const getYamlFilePatterns = (_10) => __awaiter(void 0, [_10], void 0, function* ({ inputs, workingDirectory }) {
|
||||
let filePatterns = {};
|
||||
if (inputs.filesYaml) {
|
||||
filePatterns = Object.assign({}, (yield getYamlFilePatternsFromContents({ content: inputs.filesYaml })));
|
||||
@ -2889,7 +2853,7 @@ const getOutputKey = (key, outputPrefix) => {
|
||||
return outputPrefix ? `${outputPrefix}_${key}` : key;
|
||||
};
|
||||
exports.getOutputKey = getOutputKey;
|
||||
const setArrayOutput = (_13) => __awaiter(void 0, [_13], void 0, function* ({ key, inputs, value, outputPrefix }) {
|
||||
const setArrayOutput = (_11) => __awaiter(void 0, [_11], void 0, function* ({ key, inputs, value, outputPrefix }) {
|
||||
core.debug(`${key}: ${JSON.stringify(value)}`);
|
||||
yield (0, exports.setOutput)({
|
||||
key: outputPrefix ? (0, exports.getOutputKey)(key, outputPrefix) : key,
|
||||
@ -2902,7 +2866,7 @@ const setArrayOutput = (_13) => __awaiter(void 0, [_13], void 0, function* ({ ke
|
||||
});
|
||||
});
|
||||
exports.setArrayOutput = setArrayOutput;
|
||||
const setOutput = (_14) => __awaiter(void 0, [_14], void 0, function* ({ key, value, writeOutputFiles, outputDir, json = false, shouldEscape = false, safeOutput = false }) {
|
||||
const setOutput = (_12) => __awaiter(void 0, [_12], void 0, function* ({ key, value, writeOutputFiles, outputDir, json = false, shouldEscape = false, safeOutput = false }) {
|
||||
let cleanedValue;
|
||||
if (json) {
|
||||
cleanedValue = (0, exports.jsonOutput)({ value, shouldEscape });
|
||||
@ -2925,7 +2889,7 @@ const setOutput = (_14) => __awaiter(void 0, [_14], void 0, function* ({ key, va
|
||||
}
|
||||
});
|
||||
exports.setOutput = setOutput;
|
||||
const getDeletedFileContents = (_15) => __awaiter(void 0, [_15], void 0, function* ({ cwd, filePath, sha }) {
|
||||
const getDeletedFileContents = (_13) => __awaiter(void 0, [_13], void 0, function* ({ cwd, filePath, sha }) {
|
||||
const { stdout, exitCode, stderr } = yield exec.getExecOutput('git', ['show', `${sha}:${filePath}`], {
|
||||
cwd,
|
||||
silent: !core.isDebug(),
|
||||
@ -2936,7 +2900,7 @@ const getDeletedFileContents = (_15) => __awaiter(void 0, [_15], void 0, functio
|
||||
}
|
||||
return stdout;
|
||||
});
|
||||
const recoverDeletedFiles = (_16) => __awaiter(void 0, [_16], void 0, function* ({ inputs, workingDirectory, deletedFiles, recoverPatterns, diffResult, hasSubmodule, submodulePaths }) {
|
||||
const recoverDeletedFiles = (_14) => __awaiter(void 0, [_14], void 0, function* ({ inputs, workingDirectory, deletedFiles, recoverPatterns, diffResult, hasSubmodule, submodulePaths }) {
|
||||
let recoverableDeletedFiles = deletedFiles;
|
||||
core.debug(`recoverable deleted files: ${recoverableDeletedFiles}`);
|
||||
if (recoverPatterns.length > 0) {
|
||||
@ -3001,7 +2965,7 @@ exports.recoverDeletedFiles = recoverDeletedFiles;
|
||||
* @param workingDirectory - The path of the working directory.
|
||||
* @returns A boolean value indicating whether the working directory has a local Git directory.
|
||||
*/
|
||||
const hasLocalGitDirectory = (_17) => __awaiter(void 0, [_17], void 0, function* ({ workingDirectory }) {
|
||||
const hasLocalGitDirectory = (_15) => __awaiter(void 0, [_15], void 0, function* ({ workingDirectory }) {
|
||||
return yield (0, exports.isInsideWorkTree)({
|
||||
cwd: workingDirectory
|
||||
});
|
||||
@ -3012,13 +2976,13 @@ exports.hasLocalGitDirectory = hasLocalGitDirectory;
|
||||
*
|
||||
* @param inputs - The inputs object.
|
||||
*/
|
||||
const warnUnsupportedRESTAPIInputs = (_18) => __awaiter(void 0, [_18], void 0, function* ({ inputs }) {
|
||||
var _19, _20;
|
||||
const warnUnsupportedRESTAPIInputs = (_16) => __awaiter(void 0, [_16], void 0, function* ({ inputs }) {
|
||||
var _17, _18;
|
||||
for (const key of Object.keys(constant_1.DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS)) {
|
||||
const defaultValue = Object.hasOwnProperty.call(constant_1.DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS, key)
|
||||
? (_19 = constant_1.DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[key]) === null || _19 === void 0 ? void 0 : _19.toString()
|
||||
? (_17 = constant_1.DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS[key]) === null || _17 === void 0 ? void 0 : _17.toString()
|
||||
: '';
|
||||
if (defaultValue !== ((_20 = inputs[key]) === null || _20 === void 0 ? void 0 : _20.toString())) {
|
||||
if (defaultValue !== ((_18 = inputs[key]) === null || _18 === void 0 ? void 0 : _18.toString())) {
|
||||
core.warning(`Input "${(0, lodash_1.snakeCase)(key)}" is not supported when using GitHub's REST API to get changed files`);
|
||||
}
|
||||
}
|
||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -326,7 +326,6 @@ interface SHAForPullRequestEvent {
|
||||
hasSubmodule: boolean
|
||||
gitFetchExtraArgs: string[]
|
||||
remoteName: string
|
||||
isFork: boolean
|
||||
}
|
||||
|
||||
export const getSHAForPullRequestEvent = async ({
|
||||
@ -335,8 +334,7 @@ export const getSHAForPullRequestEvent = async ({
|
||||
isShallow,
|
||||
hasSubmodule,
|
||||
gitFetchExtraArgs,
|
||||
remoteName,
|
||||
isFork
|
||||
remoteName
|
||||
}: SHAForPullRequestEvent): Promise<DiffResult> => {
|
||||
let targetBranch = github.context.payload.pull_request?.base?.ref
|
||||
const currentBranch = github.context.payload.pull_request?.head?.ref
|
||||
@ -507,18 +505,14 @@ export const getSHAForPullRequestEvent = async ({
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (github.context.payload.action === 'closed' || isFork) {
|
||||
previousSha = github.context.payload.pull_request?.base?.sha
|
||||
} else {
|
||||
previousSha = github.context.payload.pull_request?.base?.sha
|
||||
|
||||
if (!previousSha) {
|
||||
previousSha = await getRemoteBranchHeadSha({
|
||||
cwd: workingDirectory,
|
||||
branch: targetBranch,
|
||||
remoteName
|
||||
remoteName,
|
||||
branch: targetBranch
|
||||
})
|
||||
|
||||
if (!previousSha) {
|
||||
previousSha = github.context.payload.pull_request?.base?.sha
|
||||
}
|
||||
}
|
||||
|
||||
if (isShallow) {
|
||||
|
11
src/main.ts
11
src/main.ts
@ -23,7 +23,6 @@ import {
|
||||
hasLocalGitDirectory,
|
||||
isRepoShallow,
|
||||
recoverDeletedFiles,
|
||||
setForkRemote,
|
||||
setOutput,
|
||||
submoduleExists,
|
||||
updateGitGlobalConfig,
|
||||
@ -73,8 +72,7 @@ const getChangedFilesFromLocalGitHistory = async ({
|
||||
}
|
||||
|
||||
const isTag = env.GITHUB_REF?.startsWith('refs/tags/')
|
||||
const isFork = github.context.payload.pull_request?.head.repo.fork || false
|
||||
let remoteName = 'origin'
|
||||
const remoteName = 'origin'
|
||||
const outputRenamedFilesAsDeletedAndAdded =
|
||||
inputs.outputRenamedFilesAsDeletedAndAdded
|
||||
let submodulePaths: string[] = []
|
||||
@ -87,10 +85,6 @@ const getChangedFilesFromLocalGitHistory = async ({
|
||||
gitFetchExtraArgs = ['--prune', '--no-recurse-submodules']
|
||||
}
|
||||
|
||||
if (isFork) {
|
||||
remoteName = await setForkRemote({cwd: workingDirectory})
|
||||
}
|
||||
|
||||
let diffResult: DiffResult
|
||||
|
||||
if (!github.context.payload.pull_request?.base?.ref) {
|
||||
@ -117,8 +111,7 @@ const getChangedFilesFromLocalGitHistory = async ({
|
||||
isShallow,
|
||||
hasSubmodule,
|
||||
gitFetchExtraArgs,
|
||||
remoteName,
|
||||
isFork
|
||||
remoteName
|
||||
})
|
||||
}
|
||||
|
||||
|
41
src/utils.ts
41
src/utils.ts
@ -744,47 +744,6 @@ export const getParentSha = async ({cwd}: {cwd: string}): Promise<string> => {
|
||||
return stdout.trim()
|
||||
}
|
||||
|
||||
const remoteExists = async (
|
||||
cwd: string,
|
||||
remoteName: string
|
||||
): Promise<boolean> => {
|
||||
const {exitCode} = await exec.getExecOutput(
|
||||
'git',
|
||||
['remote', 'get-url', remoteName],
|
||||
{
|
||||
cwd,
|
||||
ignoreReturnCode: true,
|
||||
silent: !core.isDebug()
|
||||
}
|
||||
)
|
||||
|
||||
return exitCode === 0
|
||||
}
|
||||
|
||||
export const setForkRemote = async ({cwd}: {cwd: string}): Promise<string> => {
|
||||
const remoteName = 'changed-files-fork'
|
||||
|
||||
const remoteFound = await remoteExists(cwd, remoteName)
|
||||
|
||||
if (!remoteFound) {
|
||||
await exec.getExecOutput(
|
||||
'git',
|
||||
[
|
||||
'remote',
|
||||
'add',
|
||||
remoteName,
|
||||
github.context.payload.repository?.clone_url
|
||||
],
|
||||
{
|
||||
cwd,
|
||||
silent: !core.isDebug()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
return remoteName
|
||||
}
|
||||
|
||||
export const verifyCommitSha = async ({
|
||||
sha,
|
||||
cwd,
|
||||
|
Loading…
x
Reference in New Issue
Block a user