mirror of
https://github.com/actions/checkout.git
synced 2026-06-18 00:41:18 +08:00
Merge origin/main into aiqiaoy/update-error
This commit is contained in:
@@ -5,12 +5,12 @@ import * as fs from 'fs'
|
||||
import * as io from '@actions/io'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import * as regexpHelper from './regexp-helper'
|
||||
import * as stateHelper from './state-helper'
|
||||
import * as urlHelper from './url-helper'
|
||||
import {v4 as uuid} from 'uuid'
|
||||
import {IGitCommandManager} from './git-command-manager'
|
||||
import {IGitSourceSettings} from './git-source-settings'
|
||||
import * as regexpHelper from './regexp-helper.js'
|
||||
import * as stateHelper from './state-helper.js'
|
||||
import * as urlHelper from './url-helper.js'
|
||||
import {randomUUID} from 'crypto'
|
||||
import {IGitCommandManager} from './git-command-manager.js'
|
||||
import {IGitSourceSettings} from './git-source-settings.js'
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32'
|
||||
const SSH_COMMAND_KEY = 'core.sshCommand'
|
||||
@@ -90,7 +90,7 @@ class GitAuthHelper {
|
||||
// Create a temp home directory
|
||||
const runnerTemp = process.env['RUNNER_TEMP'] || ''
|
||||
assert.ok(runnerTemp, 'RUNNER_TEMP is not defined')
|
||||
const uniqueId = uuid()
|
||||
const uniqueId = randomUUID()
|
||||
this.temporaryHomePath = path.join(runnerTemp, uniqueId)
|
||||
await fs.promises.mkdir(this.temporaryHomePath, {recursive: true})
|
||||
|
||||
@@ -255,7 +255,7 @@ class GitAuthHelper {
|
||||
// Write key
|
||||
const runnerTemp = process.env['RUNNER_TEMP'] || ''
|
||||
assert.ok(runnerTemp, 'RUNNER_TEMP is not defined')
|
||||
const uniqueId = uuid()
|
||||
const uniqueId = randomUUID()
|
||||
this.sshKeyPath = path.join(runnerTemp, uniqueId)
|
||||
stateHelper.setSshKeyPath(this.sshKeyPath)
|
||||
await fs.promises.mkdir(runnerTemp, {recursive: true})
|
||||
@@ -422,7 +422,7 @@ class GitAuthHelper {
|
||||
assert.ok(runnerTemp, 'RUNNER_TEMP is not defined')
|
||||
|
||||
// Create a unique filename for this checkout instance
|
||||
const configFileName = `git-credentials-${uuid()}.config`
|
||||
const configFileName = `git-credentials-${randomUUID()}.config`
|
||||
this.credentialsConfigPath = path.join(runnerTemp, configFileName)
|
||||
|
||||
core.debug(`Credentials config path: ${this.credentialsConfigPath}`)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import * as fs from 'fs'
|
||||
import * as fshelper from './fs-helper'
|
||||
import * as fshelper from './fs-helper.js'
|
||||
import * as io from '@actions/io'
|
||||
import * as path from 'path'
|
||||
import * as refHelper from './ref-helper'
|
||||
import * as regexpHelper from './regexp-helper'
|
||||
import * as retryHelper from './retry-helper'
|
||||
import {GitVersion} from './git-version'
|
||||
import * as refHelper from './ref-helper.js'
|
||||
import * as regexpHelper from './regexp-helper.js'
|
||||
import * as retryHelper from './retry-helper.js'
|
||||
import {GitVersion} from './git-version.js'
|
||||
|
||||
// Auth header not supported before 2.9
|
||||
// Wire protocol v2 not supported before 2.18
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as assert from 'assert'
|
||||
import * as core from '@actions/core'
|
||||
import * as fs from 'fs'
|
||||
import * as fsHelper from './fs-helper'
|
||||
import * as fsHelper from './fs-helper.js'
|
||||
import * as io from '@actions/io'
|
||||
import * as path from 'path'
|
||||
import {IGitCommandManager} from './git-command-manager'
|
||||
import {IGitCommandManager} from './git-command-manager.js'
|
||||
|
||||
export async function prepareExistingDirectory(
|
||||
git: IGitCommandManager | undefined,
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as fsHelper from './fs-helper'
|
||||
import * as gitAuthHelper from './git-auth-helper'
|
||||
import * as gitCommandManager from './git-command-manager'
|
||||
import * as gitDirectoryHelper from './git-directory-helper'
|
||||
import * as githubApiHelper from './github-api-helper'
|
||||
import * as fsHelper from './fs-helper.js'
|
||||
import * as gitAuthHelper from './git-auth-helper.js'
|
||||
import * as gitCommandManager from './git-command-manager.js'
|
||||
import * as gitDirectoryHelper from './git-directory-helper.js'
|
||||
import * as githubApiHelper from './github-api-helper.js'
|
||||
import * as io from '@actions/io'
|
||||
import * as path from 'path'
|
||||
import * as refHelper from './ref-helper'
|
||||
import * as stateHelper from './state-helper'
|
||||
import * as urlHelper from './url-helper'
|
||||
import * as refHelper from './ref-helper.js'
|
||||
import * as stateHelper from './state-helper.js'
|
||||
import * as urlHelper from './url-helper.js'
|
||||
import {
|
||||
MinimumGitSparseCheckoutVersion,
|
||||
IGitCommandManager
|
||||
} from './git-command-manager'
|
||||
import {IGitSourceSettings} from './git-source-settings'
|
||||
} from './git-command-manager.js'
|
||||
import {IGitSourceSettings} from './git-source-settings.js'
|
||||
|
||||
export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||
// Repository URL
|
||||
|
||||
@@ -4,10 +4,10 @@ import * as fs from 'fs'
|
||||
import * as github from '@actions/github'
|
||||
import * as io from '@actions/io'
|
||||
import * as path from 'path'
|
||||
import * as retryHelper from './retry-helper'
|
||||
import * as retryHelper from './retry-helper.js'
|
||||
import * as toolCache from '@actions/tool-cache'
|
||||
import {v4 as uuid} from 'uuid'
|
||||
import {getServerApiUrl} from './url-helper'
|
||||
import {randomUUID} from 'crypto'
|
||||
import {getServerApiUrl} from './url-helper.js'
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32'
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function downloadRepository(
|
||||
|
||||
// Write archive to disk
|
||||
core.info('Writing archive to disk')
|
||||
const uniqueId = uuid()
|
||||
const uniqueId = randomUUID()
|
||||
const archivePath = IS_WINDOWS
|
||||
? path.join(repositoryPath, `${uniqueId}.zip`)
|
||||
: path.join(repositoryPath, `${uniqueId}.tar.gz`)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as fsHelper from './fs-helper'
|
||||
import * as fsHelper from './fs-helper.js'
|
||||
import * as github from '@actions/github'
|
||||
import * as path from 'path'
|
||||
import * as unsafePrCheckoutHelper from './unsafe-pr-checkout-helper'
|
||||
import * as workflowContextHelper from './workflow-context-helper'
|
||||
import {IGitSourceSettings} from './git-source-settings'
|
||||
import * as unsafePrCheckoutHelper from './unsafe-pr-checkout-helper.js'
|
||||
import * as workflowContextHelper from './workflow-context-helper.js'
|
||||
import {IGitSourceSettings} from './git-source-settings.js'
|
||||
|
||||
export async function getInputs(): Promise<IGitSourceSettings> {
|
||||
const result = {} as unknown as IGitSourceSettings
|
||||
|
||||
18
src/main.ts
18
src/main.ts
@@ -1,9 +1,11 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as coreCommand from '@actions/core/lib/command'
|
||||
import * as gitSourceProvider from './git-source-provider'
|
||||
import * as inputHelper from './input-helper'
|
||||
import * as gitSourceProvider from './git-source-provider.js'
|
||||
import * as inputHelper from './input-helper.js'
|
||||
import * as path from 'path'
|
||||
import * as stateHelper from './state-helper'
|
||||
import * as stateHelper from './state-helper.js'
|
||||
import {fileURLToPath} from 'url'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
@@ -11,10 +13,8 @@ async function run(): Promise<void> {
|
||||
|
||||
try {
|
||||
// Register problem matcher
|
||||
coreCommand.issueCommand(
|
||||
'add-matcher',
|
||||
{},
|
||||
path.join(__dirname, 'problem-matcher.json')
|
||||
core.info(
|
||||
`::add-matcher::${path.join(__dirname, 'problem-matcher.json')}`
|
||||
)
|
||||
|
||||
// Get sources
|
||||
@@ -22,7 +22,7 @@ async function run(): Promise<void> {
|
||||
core.setOutput('ref', sourceSettings.ref)
|
||||
} finally {
|
||||
// Unregister problem matcher
|
||||
coreCommand.issueCommand('remove-matcher', {owner: 'checkout-git'}, '')
|
||||
core.info('::remove-matcher owner=checkout-git::')
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(`${(error as any)?.message ?? error}`)
|
||||
|
||||
@@ -2,6 +2,9 @@ import * as fs from 'fs'
|
||||
import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import * as yaml from 'js-yaml'
|
||||
import {fileURLToPath} from 'url'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
//
|
||||
// SUMMARY
|
||||
@@ -120,7 +123,7 @@ function updateUsage(
|
||||
}
|
||||
|
||||
updateUsage(
|
||||
'actions/checkout@v6',
|
||||
'actions/checkout@v7',
|
||||
path.join(__dirname, '..', '..', 'action.yml'),
|
||||
path.join(__dirname, '..', '..', 'README.md')
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {IGitCommandManager} from './git-command-manager'
|
||||
import {IGitCommandManager} from './git-command-manager.js'
|
||||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
import {getServerApiUrl, isGhes} from './url-helper'
|
||||
import {getServerApiUrl, isGhes} from './url-helper.js'
|
||||
|
||||
export const tagsRefSpec = '+refs/tags/*:refs/tags/*'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as github from '@actions/github'
|
||||
import {fromPayload} from './ref-helper'
|
||||
import {fromPayload} from './ref-helper.js'
|
||||
|
||||
const PR_REF_PATTERN = /^refs\/pull\/[0-9]+\/(?:head|merge)$/
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as assert from 'assert'
|
||||
import {URL} from 'url'
|
||||
import {IGitSourceSettings} from './git-source-settings'
|
||||
import {IGitSourceSettings} from './git-source-settings.js'
|
||||
|
||||
export function getFetchUrl(settings: IGitSourceSettings): string {
|
||||
assert.ok(
|
||||
|
||||
Reference in New Issue
Block a user