mirror of
				https://github.com/actions/checkout.git
				synced 2025-11-04 05:58:40 +08:00 
			
		
		
		
	Fix eslint script and related code
This commit is contained in:
		
							parent
							
								
									72f2cec99f
								
							
						
					
					
						commit
						ed3e1da142
					
				| 
						 | 
					@ -21,7 +21,7 @@
 | 
				
			||||||
    "@typescript-eslint/func-call-spacing": ["error", "never"],
 | 
					    "@typescript-eslint/func-call-spacing": ["error", "never"],
 | 
				
			||||||
    "@typescript-eslint/no-array-constructor": "error",
 | 
					    "@typescript-eslint/no-array-constructor": "error",
 | 
				
			||||||
    "@typescript-eslint/no-empty-interface": "error",
 | 
					    "@typescript-eslint/no-empty-interface": "error",
 | 
				
			||||||
    "@typescript-eslint/no-explicit-any": "error",
 | 
					    "@typescript-eslint/no-explicit-any": "off",
 | 
				
			||||||
    "@typescript-eslint/no-extraneous-class": "error",
 | 
					    "@typescript-eslint/no-extraneous-class": "error",
 | 
				
			||||||
    "@typescript-eslint/no-floating-promises": "error",
 | 
					    "@typescript-eslint/no-floating-promises": "error",
 | 
				
			||||||
    "@typescript-eslint/no-for-in-array": "error",
 | 
					    "@typescript-eslint/no-for-in-array": "error",
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,9 @@
 | 
				
			||||||
    "semi": "off",
 | 
					    "semi": "off",
 | 
				
			||||||
    "@typescript-eslint/semi": ["error", "never"],
 | 
					    "@typescript-eslint/semi": ["error", "never"],
 | 
				
			||||||
    "@typescript-eslint/type-annotation-spacing": "error",
 | 
					    "@typescript-eslint/type-annotation-spacing": "error",
 | 
				
			||||||
    "@typescript-eslint/unbound-method": "error"
 | 
					    "@typescript-eslint/unbound-method": "error",
 | 
				
			||||||
 | 
					    "i18n-text/no-en": "off",
 | 
				
			||||||
 | 
					    "github/no-then": "off"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "env": {
 | 
					  "env": {
 | 
				
			||||||
    "node": true,
 | 
					    "node": true,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										26
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| 
						 | 
					@ -305,7 +305,7 @@ class GitAuthHelper {
 | 
				
			||||||
            this.sshKeyPath = path.join(runnerTemp, uniqueId);
 | 
					            this.sshKeyPath = path.join(runnerTemp, uniqueId);
 | 
				
			||||||
            stateHelper.setSshKeyPath(this.sshKeyPath);
 | 
					            stateHelper.setSshKeyPath(this.sshKeyPath);
 | 
				
			||||||
            yield fs.promises.mkdir(runnerTemp, { recursive: true });
 | 
					            yield fs.promises.mkdir(runnerTemp, { recursive: true });
 | 
				
			||||||
            yield fs.promises.writeFile(this.sshKeyPath, this.settings.sshKey.trim() + '\n', { mode: 0o600 });
 | 
					            yield fs.promises.writeFile(this.sshKeyPath, `${this.settings.sshKey.trim()}\n`, { mode: 0o600 });
 | 
				
			||||||
            // Remove inherited permissions on Windows
 | 
					            // Remove inherited permissions on Windows
 | 
				
			||||||
            if (IS_WINDOWS) {
 | 
					            if (IS_WINDOWS) {
 | 
				
			||||||
                const icacls = yield io.which('icacls.exe');
 | 
					                const icacls = yield io.which('icacls.exe');
 | 
				
			||||||
| 
						 | 
					@ -371,7 +371,7 @@ class GitAuthHelper {
 | 
				
			||||||
            let content = (yield fs.promises.readFile(configPath)).toString();
 | 
					            let content = (yield fs.promises.readFile(configPath)).toString();
 | 
				
			||||||
            const placeholderIndex = content.indexOf(this.tokenPlaceholderConfigValue);
 | 
					            const placeholderIndex = content.indexOf(this.tokenPlaceholderConfigValue);
 | 
				
			||||||
            if (placeholderIndex < 0 ||
 | 
					            if (placeholderIndex < 0 ||
 | 
				
			||||||
                placeholderIndex != content.lastIndexOf(this.tokenPlaceholderConfigValue)) {
 | 
					                placeholderIndex !== content.lastIndexOf(this.tokenPlaceholderConfigValue)) {
 | 
				
			||||||
                throw new Error(`Unable to replace auth placeholder in ${configPath}`);
 | 
					                throw new Error(`Unable to replace auth placeholder in ${configPath}`);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            assert.ok(this.tokenConfigValue, 'tokenConfigValue is not defined');
 | 
					            assert.ok(this.tokenConfigValue, 'tokenConfigValue is not defined');
 | 
				
			||||||
| 
						 | 
					@ -1326,7 +1326,7 @@ function getSource(settings) {
 | 
				
			||||||
                    yield authHelper.removeAuth();
 | 
					                    yield authHelper.removeAuth();
 | 
				
			||||||
                    core.endGroup();
 | 
					                    core.endGroup();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                authHelper.removeGlobalConfig();
 | 
					                yield authHelper.removeGlobalConfig();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
| 
						 | 
					@ -1514,8 +1514,8 @@ const io = __importStar(__nccwpck_require__(7436));
 | 
				
			||||||
const path = __importStar(__nccwpck_require__(1017));
 | 
					const path = __importStar(__nccwpck_require__(1017));
 | 
				
			||||||
const retryHelper = __importStar(__nccwpck_require__(2155));
 | 
					const retryHelper = __importStar(__nccwpck_require__(2155));
 | 
				
			||||||
const toolCache = __importStar(__nccwpck_require__(7784));
 | 
					const toolCache = __importStar(__nccwpck_require__(7784));
 | 
				
			||||||
const v4_1 = __importDefault(__nccwpck_require__(824));
 | 
					 | 
				
			||||||
const url_helper_1 = __nccwpck_require__(9437);
 | 
					const url_helper_1 = __nccwpck_require__(9437);
 | 
				
			||||||
 | 
					const v4_1 = __importDefault(__nccwpck_require__(824));
 | 
				
			||||||
const IS_WINDOWS = process.platform === 'win32';
 | 
					const IS_WINDOWS = process.platform === 'win32';
 | 
				
			||||||
function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath, baseUrl) {
 | 
					function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath, baseUrl) {
 | 
				
			||||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
					    return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
| 
						 | 
					@ -1549,7 +1549,7 @@ function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath,
 | 
				
			||||||
        // Determine the path of the repository content. The archive contains
 | 
					        // Determine the path of the repository content. The archive contains
 | 
				
			||||||
        // a top-level folder and the repository content is inside.
 | 
					        // a top-level folder and the repository content is inside.
 | 
				
			||||||
        const archiveFileNames = yield fs.promises.readdir(extractPath);
 | 
					        const archiveFileNames = yield fs.promises.readdir(extractPath);
 | 
				
			||||||
        assert.ok(archiveFileNames.length == 1, 'Expected exactly one directory inside archive');
 | 
					        assert.ok(archiveFileNames.length === 1, 'Expected exactly one directory inside archive');
 | 
				
			||||||
        const archiveVersion = archiveFileNames[0]; // The top-level folder name includes the short SHA
 | 
					        const archiveVersion = archiveFileNames[0]; // The top-level folder name includes the short SHA
 | 
				
			||||||
        core.info(`Resolved version ${archiveVersion}`);
 | 
					        core.info(`Resolved version ${archiveVersion}`);
 | 
				
			||||||
        const tempRepositoryPath = path.join(extractPath, archiveVersion);
 | 
					        const tempRepositoryPath = path.join(extractPath, archiveVersion);
 | 
				
			||||||
| 
						 | 
					@ -1617,8 +1617,8 @@ function downloadArchive(authToken, owner, repo, ref, commit, baseUrl) {
 | 
				
			||||||
            ? octokit.rest.repos.downloadZipballArchive
 | 
					            ? octokit.rest.repos.downloadZipballArchive
 | 
				
			||||||
            : octokit.rest.repos.downloadTarballArchive;
 | 
					            : octokit.rest.repos.downloadTarballArchive;
 | 
				
			||||||
        const response = yield download({
 | 
					        const response = yield download({
 | 
				
			||||||
            owner: owner,
 | 
					            owner,
 | 
				
			||||||
            repo: repo,
 | 
					            repo,
 | 
				
			||||||
            ref: commit || ref
 | 
					            ref: commit || ref
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return Buffer.from(response.data); // response.data is ArrayBuffer
 | 
					        return Buffer.from(response.data); // response.data is ArrayBuffer
 | 
				
			||||||
| 
						 | 
					@ -1753,11 +1753,11 @@ function getInputs() {
 | 
				
			||||||
        result.submodules = false;
 | 
					        result.submodules = false;
 | 
				
			||||||
        result.nestedSubmodules = false;
 | 
					        result.nestedSubmodules = false;
 | 
				
			||||||
        const submodulesString = (core.getInput('submodules') || '').toUpperCase();
 | 
					        const submodulesString = (core.getInput('submodules') || '').toUpperCase();
 | 
				
			||||||
        if (submodulesString == 'RECURSIVE') {
 | 
					        if (submodulesString === 'RECURSIVE') {
 | 
				
			||||||
            result.submodules = true;
 | 
					            result.submodules = true;
 | 
				
			||||||
            result.nestedSubmodules = true;
 | 
					            result.nestedSubmodules = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else if (submodulesString == 'TRUE') {
 | 
					        else if (submodulesString === 'TRUE') {
 | 
				
			||||||
            result.submodules = true;
 | 
					            result.submodules = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        core.debug(`submodules = ${result.submodules}`);
 | 
					        core.debug(`submodules = ${result.submodules}`);
 | 
				
			||||||
| 
						 | 
					@ -1862,11 +1862,11 @@ function cleanup() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// Main
 | 
					// Main
 | 
				
			||||||
if (!stateHelper.IsPost) {
 | 
					if (!stateHelper.IsPost) {
 | 
				
			||||||
    run();
 | 
					    void run();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// Post
 | 
					// Post
 | 
				
			||||||
else {
 | 
					else {
 | 
				
			||||||
    cleanup();
 | 
					    void cleanup();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2096,7 +2096,7 @@ function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // Expected message?
 | 
					            // Expected message?
 | 
				
			||||||
            const expectedMessage = `Merge ${expectedHeadSha} into ${expectedBaseSha}`;
 | 
					            const expectedMessage = `Merge ${expectedHeadSha} into ${expectedBaseSha}`;
 | 
				
			||||||
            if (commitInfo.indexOf(expectedMessage) >= 0) {
 | 
					            if (commitInfo.includes(expectedMessage)) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // Extract details from message
 | 
					            // Extract details from message
 | 
				
			||||||
| 
						 | 
					@ -2378,7 +2378,7 @@ function getFetchUrl(settings) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
exports.getFetchUrl = getFetchUrl;
 | 
					exports.getFetchUrl = getFetchUrl;
 | 
				
			||||||
function getServerUrl(url) {
 | 
					function getServerUrl(url) {
 | 
				
			||||||
    let urlValue = url && url.trim().length > 0
 | 
					    const urlValue = url && url.trim().length > 0
 | 
				
			||||||
        ? url
 | 
					        ? url
 | 
				
			||||||
        : process.env['GITHUB_SERVER_URL'] || 'https://github.com';
 | 
					        : process.env['GITHUB_SERVER_URL'] || 'https://github.com';
 | 
				
			||||||
    return new url_1.URL(urlValue);
 | 
					    return new url_1.URL(urlValue);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,7 @@
 | 
				
			||||||
    "build": "tsc && ncc build && node lib/misc/generate-docs.js",
 | 
					    "build": "tsc && ncc build && node lib/misc/generate-docs.js",
 | 
				
			||||||
    "format": "prettier --write '**/*.ts'",
 | 
					    "format": "prettier --write '**/*.ts'",
 | 
				
			||||||
    "format-check": "prettier --check '**/*.ts'",
 | 
					    "format-check": "prettier --check '**/*.ts'",
 | 
				
			||||||
    "lint": "eslint src/**/*.ts",
 | 
					    "lint": "eslint 'src/**/*.ts'",
 | 
				
			||||||
    "test": "jest",
 | 
					    "test": "jest",
 | 
				
			||||||
    "licensed-check": "src/misc/licensed-check.sh",
 | 
					    "licensed-check": "src/misc/licensed-check.sh",
 | 
				
			||||||
    "licensed-generate": "src/misc/licensed-generate.sh"
 | 
					    "licensed-generate": "src/misc/licensed-generate.sh"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,9 +8,9 @@ import * as path from 'path'
 | 
				
			||||||
import * as regexpHelper from './regexp-helper'
 | 
					import * as regexpHelper from './regexp-helper'
 | 
				
			||||||
import * as stateHelper from './state-helper'
 | 
					import * as stateHelper from './state-helper'
 | 
				
			||||||
import * as urlHelper from './url-helper'
 | 
					import * as urlHelper from './url-helper'
 | 
				
			||||||
import {default as uuid} from 'uuid/v4'
 | 
					 | 
				
			||||||
import {IGitCommandManager} from './git-command-manager'
 | 
					import {IGitCommandManager} from './git-command-manager'
 | 
				
			||||||
import {IGitSourceSettings} from './git-source-settings'
 | 
					import {IGitSourceSettings} from './git-source-settings'
 | 
				
			||||||
 | 
					import {default as uuid} from 'uuid/v4'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const IS_WINDOWS = process.platform === 'win32'
 | 
					const IS_WINDOWS = process.platform === 'win32'
 | 
				
			||||||
const SSH_COMMAND_KEY = 'core.sshCommand'
 | 
					const SSH_COMMAND_KEY = 'core.sshCommand'
 | 
				
			||||||
| 
						 | 
					@ -215,7 +215,7 @@ class GitAuthHelper {
 | 
				
			||||||
    await fs.promises.mkdir(runnerTemp, {recursive: true})
 | 
					    await fs.promises.mkdir(runnerTemp, {recursive: true})
 | 
				
			||||||
    await fs.promises.writeFile(
 | 
					    await fs.promises.writeFile(
 | 
				
			||||||
      this.sshKeyPath,
 | 
					      this.sshKeyPath,
 | 
				
			||||||
      this.settings.sshKey.trim() + '\n',
 | 
					      `${this.settings.sshKey.trim()}\n`,
 | 
				
			||||||
      {mode: 0o600}
 | 
					      {mode: 0o600}
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -306,7 +306,7 @@ class GitAuthHelper {
 | 
				
			||||||
    const placeholderIndex = content.indexOf(this.tokenPlaceholderConfigValue)
 | 
					    const placeholderIndex = content.indexOf(this.tokenPlaceholderConfigValue)
 | 
				
			||||||
    if (
 | 
					    if (
 | 
				
			||||||
      placeholderIndex < 0 ||
 | 
					      placeholderIndex < 0 ||
 | 
				
			||||||
      placeholderIndex != content.lastIndexOf(this.tokenPlaceholderConfigValue)
 | 
					      placeholderIndex !== content.lastIndexOf(this.tokenPlaceholderConfigValue)
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
      throw new Error(`Unable to replace auth placeholder in ${configPath}`)
 | 
					      throw new Error(`Unable to replace auth placeholder in ${configPath}`)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -352,7 +352,7 @@ class GitAuthHelper {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async removeGitConfig(
 | 
					  private async removeGitConfig(
 | 
				
			||||||
    configKey: string,
 | 
					    configKey: string,
 | 
				
			||||||
    submoduleOnly: boolean = false
 | 
					    submoduleOnly = false
 | 
				
			||||||
  ): Promise<void> {
 | 
					  ): Promise<void> {
 | 
				
			||||||
    if (!submoduleOnly) {
 | 
					    if (!submoduleOnly) {
 | 
				
			||||||
      if (
 | 
					      if (
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -266,7 +266,7 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
 | 
				
			||||||
        await authHelper.removeAuth()
 | 
					        await authHelper.removeAuth()
 | 
				
			||||||
        core.endGroup()
 | 
					        core.endGroup()
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      authHelper.removeGlobalConfig()
 | 
					      await authHelper.removeGlobalConfig()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,8 +6,8 @@ import * as io from '@actions/io'
 | 
				
			||||||
import * as path from 'path'
 | 
					import * as path from 'path'
 | 
				
			||||||
import * as retryHelper from './retry-helper'
 | 
					import * as retryHelper from './retry-helper'
 | 
				
			||||||
import * as toolCache from '@actions/tool-cache'
 | 
					import * as toolCache from '@actions/tool-cache'
 | 
				
			||||||
import {default as uuid} from 'uuid/v4'
 | 
					 | 
				
			||||||
import {getServerApiUrl} from './url-helper'
 | 
					import {getServerApiUrl} from './url-helper'
 | 
				
			||||||
 | 
					import {default as uuid} from 'uuid/v4'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const IS_WINDOWS = process.platform === 'win32'
 | 
					const IS_WINDOWS = process.platform === 'win32'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,7 @@ export async function downloadRepository(
 | 
				
			||||||
  // a top-level folder and the repository content is inside.
 | 
					  // a top-level folder and the repository content is inside.
 | 
				
			||||||
  const archiveFileNames = await fs.promises.readdir(extractPath)
 | 
					  const archiveFileNames = await fs.promises.readdir(extractPath)
 | 
				
			||||||
  assert.ok(
 | 
					  assert.ok(
 | 
				
			||||||
    archiveFileNames.length == 1,
 | 
					    archiveFileNames.length === 1,
 | 
				
			||||||
    'Expected exactly one directory inside archive'
 | 
					    'Expected exactly one directory inside archive'
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
  const archiveVersion = archiveFileNames[0] // The top-level folder name includes the short SHA
 | 
					  const archiveVersion = archiveFileNames[0] // The top-level folder name includes the short SHA
 | 
				
			||||||
| 
						 | 
					@ -135,8 +135,8 @@ async function downloadArchive(
 | 
				
			||||||
    ? octokit.rest.repos.downloadZipballArchive
 | 
					    ? octokit.rest.repos.downloadZipballArchive
 | 
				
			||||||
    : octokit.rest.repos.downloadTarballArchive
 | 
					    : octokit.rest.repos.downloadTarballArchive
 | 
				
			||||||
  const response = await download({
 | 
					  const response = await download({
 | 
				
			||||||
    owner: owner,
 | 
					    owner,
 | 
				
			||||||
    repo: repo,
 | 
					    repo,
 | 
				
			||||||
    ref: commit || ref
 | 
					    ref: commit || ref
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
  return Buffer.from(response.data as ArrayBuffer) // response.data is ArrayBuffer
 | 
					  return Buffer.from(response.data as ArrayBuffer) // response.data is ArrayBuffer
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,10 +118,10 @@ export async function getInputs(): Promise<IGitSourceSettings> {
 | 
				
			||||||
  result.submodules = false
 | 
					  result.submodules = false
 | 
				
			||||||
  result.nestedSubmodules = false
 | 
					  result.nestedSubmodules = false
 | 
				
			||||||
  const submodulesString = (core.getInput('submodules') || '').toUpperCase()
 | 
					  const submodulesString = (core.getInput('submodules') || '').toUpperCase()
 | 
				
			||||||
  if (submodulesString == 'RECURSIVE') {
 | 
					  if (submodulesString === 'RECURSIVE') {
 | 
				
			||||||
    result.submodules = true
 | 
					    result.submodules = true
 | 
				
			||||||
    result.nestedSubmodules = true
 | 
					    result.nestedSubmodules = true
 | 
				
			||||||
  } else if (submodulesString == 'TRUE') {
 | 
					  } else if (submodulesString === 'TRUE') {
 | 
				
			||||||
    result.submodules = true
 | 
					    result.submodules = true
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  core.debug(`submodules = ${result.submodules}`)
 | 
					  core.debug(`submodules = ${result.submodules}`)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,9 +38,9 @@ async function cleanup(): Promise<void> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Main
 | 
					// Main
 | 
				
			||||||
if (!stateHelper.IsPost) {
 | 
					if (!stateHelper.IsPost) {
 | 
				
			||||||
  run()
 | 
					  void run()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// Post
 | 
					// Post
 | 
				
			||||||
else {
 | 
					else {
 | 
				
			||||||
  cleanup()
 | 
					  void cleanup()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
import {IGitCommandManager} from './git-command-manager'
 | 
					 | 
				
			||||||
import * as core from '@actions/core'
 | 
					import * as core from '@actions/core'
 | 
				
			||||||
import * as github from '@actions/github'
 | 
					import * as github from '@actions/github'
 | 
				
			||||||
import {getServerApiUrl, isGhes} from './url-helper'
 | 
					import {getServerApiUrl, isGhes} from './url-helper'
 | 
				
			||||||
 | 
					import {IGitCommandManager} from './git-command-manager'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const tagsRefSpec = '+refs/tags/*:refs/tags/*'
 | 
					export const tagsRefSpec = '+refs/tags/*:refs/tags/*'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -227,7 +227,7 @@ export async function checkCommitInfo(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Expected message?
 | 
					    // Expected message?
 | 
				
			||||||
    const expectedMessage = `Merge ${expectedHeadSha} into ${expectedBaseSha}`
 | 
					    const expectedMessage = `Merge ${expectedHeadSha} into ${expectedBaseSha}`
 | 
				
			||||||
    if (commitInfo.indexOf(expectedMessage) >= 0) {
 | 
					    if (commitInfo.includes(expectedMessage)) {
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,28 +28,28 @@ export const SshKnownHostsPath = core.getState('sshKnownHostsPath')
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Save the repository path so the POST action can retrieve the value.
 | 
					 * Save the repository path so the POST action can retrieve the value.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function setRepositoryPath(repositoryPath: string) {
 | 
					export function setRepositoryPath(repositoryPath: string): void {
 | 
				
			||||||
  core.saveState('repositoryPath', repositoryPath)
 | 
					  core.saveState('repositoryPath', repositoryPath)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Save the SSH key path so the POST action can retrieve the value.
 | 
					 * Save the SSH key path so the POST action can retrieve the value.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function setSshKeyPath(sshKeyPath: string) {
 | 
					export function setSshKeyPath(sshKeyPath: string): void {
 | 
				
			||||||
  core.saveState('sshKeyPath', sshKeyPath)
 | 
					  core.saveState('sshKeyPath', sshKeyPath)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Save the SSH known hosts path so the POST action can retrieve the value.
 | 
					 * Save the SSH known hosts path so the POST action can retrieve the value.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function setSshKnownHostsPath(sshKnownHostsPath: string) {
 | 
					export function setSshKnownHostsPath(sshKnownHostsPath: string): void {
 | 
				
			||||||
  core.saveState('sshKnownHostsPath', sshKnownHostsPath)
 | 
					  core.saveState('sshKnownHostsPath', sshKnownHostsPath)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Save the set-safe-directory input so the POST action can retrieve the value.
 | 
					 * Save the set-safe-directory input so the POST action can retrieve the value.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function setSafeDirectory() {
 | 
					export function setSafeDirectory(): void {
 | 
				
			||||||
  core.saveState('setSafeDirectory', 'true')
 | 
					  core.saveState('setSafeDirectory', 'true')
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
import * as assert from 'assert'
 | 
					import * as assert from 'assert'
 | 
				
			||||||
import {URL} from 'url'
 | 
					 | 
				
			||||||
import {IGitSourceSettings} from './git-source-settings'
 | 
					import {IGitSourceSettings} from './git-source-settings'
 | 
				
			||||||
 | 
					import {URL} from 'url'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function getFetchUrl(settings: IGitSourceSettings): string {
 | 
					export function getFetchUrl(settings: IGitSourceSettings): string {
 | 
				
			||||||
  assert.ok(
 | 
					  assert.ok(
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ export function getFetchUrl(settings: IGitSourceSettings): string {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function getServerUrl(url?: string): URL {
 | 
					export function getServerUrl(url?: string): URL {
 | 
				
			||||||
  let urlValue =
 | 
					  const urlValue =
 | 
				
			||||||
    url && url.trim().length > 0
 | 
					    url && url.trim().length > 0
 | 
				
			||||||
      ? url
 | 
					      ? url
 | 
				
			||||||
      : process.env['GITHUB_SERVER_URL'] || 'https://github.com'
 | 
					      : process.env['GITHUB_SERVER_URL'] || 'https://github.com'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ export async function getOrganizationId(): Promise<number | undefined> {
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return id as number
 | 
					    return id
 | 
				
			||||||
  } catch (err) {
 | 
					  } catch (err) {
 | 
				
			||||||
    core.debug(
 | 
					    core.debug(
 | 
				
			||||||
      `Unable to load organization ID from GITHUB_EVENT_PATH: ${(err as any)
 | 
					      `Unable to load organization ID from GITHUB_EVENT_PATH: ${(err as any)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user