Skip to content

Commit

Permalink
Deprecate 'wrapper-validation-action'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bigdaz committed Apr 12, 2024
1 parent 0325d99 commit 6d55902
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
20 changes: 20 additions & 0 deletions docs/deprecation-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sources/src/deprecation-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`)
Expand Down
12 changes: 12 additions & 0 deletions sources/src/wrapper-validation/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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)
}
Expand Down

0 comments on commit 6d55902

Please sign in to comment.