Deprecate 'wrapper-validation-action'

Deprecation warning will be emitted when we:
- Change 'wrapper-validation-action' to delegate to 'actions/wrapper-validation'
- Add the 'wrapper-validation-action' id as env var before delegating
This commit is contained in:
daz 2024-04-12 10:01:04 -06:00 committed by Daz DeBoer
parent 0325d99e52
commit 6d55902761
3 changed files with 34 additions and 2 deletions

View file

@ -23,6 +23,26 @@ with
uses: gradle/actions/setup-gradle@v3 uses: gradle/actions/setup-gradle@v3
``` ```
## The action `gradle/wrapper-validation-action` has been replaced by `gradle/actions/wrapper-validation`
To facilitate ongoing development, the `wrapper-validation-action` action implementation has been merged into
the https://github.com/gradle/actions repository, and the `gradle/wrapper-validation-action` has been replaced by the `gradle/actions/wrapper-validation` action.
As of `v3.x`, the `gradle/wrapper-validation-action` and `gradle/actions/wrappper-validation` actions are
functionally identical, and are released with the same versions.
In a future major version (likely `v4.x`) we will stop releasing new versions of `gradle/wrapper-validation-action`:
development and releases will continue in the `gradle/actions/wrapper-validation` action.
To convert your workflows, simply replace:
```
uses: gradle/wrapper-validation-action@v3
```
with
```
uses: gradle/actions/wrapper-validation@v3
```
## Using the action to execute Gradle via the `arguments` parameter is deprecated ## Using the action to execute Gradle via the `arguments` parameter is deprecated
The core functionality of the `setup-gradle` (and `gradle-build-action`) actions is to configure your The core functionality of the `setup-gradle` (and `gradle-build-action`) actions is to configure your

View file

@ -26,10 +26,10 @@ export function getDeprecations(): Deprecation[] {
return recordedDeprecations return recordedDeprecations
} }
export function emitDeprecationWarnings(): void { export function emitDeprecationWarnings(hasJobSummary = true): void {
if (recordedDeprecations.length > 0) { if (recordedDeprecations.length > 0) {
core.warning( core.warning(
`This job uses deprecated functionality from the '${getActionId()}' action. Consult the Job Summary for more details.` `This job uses deprecated functionality from the '${getActionId()}' action. Consult the ${hasJobSummary ? 'Job Summary' : 'logs'} for more details.`
) )
for (const deprecation of recordedDeprecations) { for (const deprecation of recordedDeprecations) {
core.info(`DEPRECATION: ${deprecation.message}. See ${deprecation.getDocumentationLink()}`) core.info(`DEPRECATION: ${deprecation.message}. See ${deprecation.getDocumentationLink()}`)

View file

@ -2,10 +2,20 @@ import * as path from 'path'
import * as core from '@actions/core' import * as core from '@actions/core'
import * as validate from './validate' import * as validate from './validate'
import {getActionId, setActionId} from '../configuration'
import {recordDeprecation, emitDeprecationWarnings} from '../deprecation-collector'
import {handleMainActionError} from '../errors' import {handleMainActionError} from '../errors'
export async function run(): Promise<void> { export async function run(): Promise<void> {
try { try {
if (getActionId() === 'gradle/wrapper-validation-action') {
recordDeprecation(
'The action `gradle/wrapper-validation-action` has been replaced by `gradle/actions/wrapper-validation`'
)
} else {
setActionId('gradle/actions/wrapper-validation')
}
const result = await validate.findInvalidWrapperJars( const result = await validate.findInvalidWrapperJars(
path.resolve('.'), path.resolve('.'),
+core.getInput('min-wrapper-count'), +core.getInput('min-wrapper-count'),
@ -22,6 +32,8 @@ export async function run(): Promise<void> {
core.setOutput('failed-wrapper', `${result.invalid.map(w => w.path).join('|')}`) core.setOutput('failed-wrapper', `${result.invalid.map(w => w.path).join('|')}`)
} }
} }
emitDeprecationWarnings(false)
} catch (error) { } catch (error) {
handleMainActionError(error) handleMainActionError(error)
} }