mirror of
https://github.com/actions/checkout.git
synced 2026-01-18 01:58:32 +00:00
Some checks failed
Build and Test / test (macos-latest) (push) Waiting to run
Build and Test / test (windows-latest) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Failing after 18s
Check dist / check-dist (push) Successful in 23s
Licensed / Check licenses (push) Successful in 20s
Build and Test / build (push) Failing after 27s
Build and Test / test-proxy (push) Failing after 22s
Build and Test / test (ubuntu-latest) (push) Failing after 49s
Build and Test / test-git-container (push) Failing after 19s
Build and Test / test-bypass-proxy (push) Failing after 42s
Build and Test / test-output (push) Successful in 13s
Signed-off-by: Luca Comellini <luca.com@gmail.com>
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
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 path from 'path'
|
|
import * as stateHelper from './state-helper'
|
|
|
|
async function run(): Promise<void> {
|
|
try {
|
|
const sourceSettings = await inputHelper.getInputs()
|
|
|
|
try {
|
|
// Register problem matcher
|
|
coreCommand.issueCommand(
|
|
'add-matcher',
|
|
{},
|
|
path.join(__dirname, 'problem-matcher.json')
|
|
)
|
|
|
|
// Get sources
|
|
await gitSourceProvider.getSource(sourceSettings)
|
|
core.setOutput('ref', sourceSettings.ref)
|
|
} finally {
|
|
// Unregister problem matcher
|
|
coreCommand.issueCommand('remove-matcher', {owner: 'checkout-git'}, '')
|
|
}
|
|
} catch (error) {
|
|
core.setFailed(`${(error as any)?.message ?? error}`)
|
|
}
|
|
}
|
|
|
|
async function cleanup(): Promise<void> {
|
|
try {
|
|
await gitSourceProvider.cleanup(stateHelper.RepositoryPath)
|
|
} catch (error) {
|
|
core.warning(`${(error as any)?.message ?? error}`)
|
|
}
|
|
}
|
|
|
|
// Main
|
|
if (!stateHelper.IsPost) {
|
|
run()
|
|
}
|
|
// Post
|
|
else {
|
|
cleanup()
|
|
}
|