mirror of
https://github.com/gradle/actions.git
synced 2025-11-26 17:09:10 +08:00
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import * as path from 'path'
|
|
import * as core from '@actions/core'
|
|
|
|
import * as validate from '../../wrapper-validation/validate'
|
|
import {getActionId, setActionId} from '../../configuration'
|
|
import {failOnUseOfRemovedFeature, emitDeprecationWarnings} from '../../deprecation-collector'
|
|
import {handleMainActionError} from '../../errors'
|
|
|
|
export async function run(): Promise<void> {
|
|
try {
|
|
if (getActionId() === 'gradle/wrapper-validation-action') {
|
|
failOnUseOfRemovedFeature(
|
|
'The action `gradle/wrapper-validation-action` has been replaced by `gradle/actions/wrapper-validation`'
|
|
)
|
|
}
|
|
|
|
setActionId('gradle/actions/wrapper-validation')
|
|
|
|
const result = await validate.findInvalidWrapperJars(
|
|
path.resolve('.'),
|
|
+core.getInput('min-wrapper-count'),
|
|
core.getInput('allow-snapshots') === 'true',
|
|
core.getInput('allow-checksums').split(',')
|
|
)
|
|
if (result.isValid()) {
|
|
core.info(result.toDisplayString())
|
|
} else {
|
|
core.setFailed(
|
|
`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#reporting-failures\n${result.toDisplayString()}`
|
|
)
|
|
if (result.invalid.length > 0) {
|
|
core.setOutput('failed-wrapper', `${result.invalid.map(w => w.path).join('|')}`)
|
|
}
|
|
}
|
|
|
|
emitDeprecationWarnings(false)
|
|
} catch (error) {
|
|
handleMainActionError(error)
|
|
}
|
|
}
|
|
|
|
run()
|