Commit 6d559027 authored by daz's avatar daz Committed by Daz DeBoer
Browse files

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
parent 0325d99e
Loading
Loading
Loading
Loading
+20
Changes for docs/deprecation-upgrade-guide.md: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -23,6 +23,26 @@ with
    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

The core functionality of the `setup-gradle` (and `gradle-build-action`) actions is to configure your
+2 −2
Changes for sources/src/deprecation-collector.ts: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -26,10 +26,10 @@ export function getDeprecations(): Deprecation[] {
    return recordedDeprecations
}

export function emitDeprecationWarnings(): void {
export function emitDeprecationWarnings(hasJobSummary = true): void {
    if (recordedDeprecations.length > 0) {
        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) {
            core.info(`DEPRECATION: ${deprecation.message}. See ${deprecation.getDocumentationLink()}`)
+12
Changes for sources/src/wrapper-validation/main.ts: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,10 +2,20 @@ import * as path from 'path'
import * as core from '@actions/core'

import * as validate from './validate'
import {getActionId, setActionId} from '../configuration'
import {recordDeprecation, emitDeprecationWarnings} from '../deprecation-collector'
import {handleMainActionError} from '../errors'

export async function run(): Promise<void> {
    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(
            path.resolve('.'),
            +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('|')}`)
            }
        }

        emitDeprecationWarnings(false)
    } catch (error) {
        handleMainActionError(error)
    }