gradle-build-action icon indicating copy to clipboard operation
gradle-build-action copied to clipboard

Migrate away from the `save-state` command to Environment Files

Open sschuberth opened this issue 2 years ago • 3 comments

I'm getting warnings that

The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

This is just a heads-up to plan for the migration.

sschuberth avatar Oct 12 '22 09:10 sschuberth

If I read that right, this should be solved by #455

tbroyer avatar Oct 12 '22 09:10 tbroyer

@tbroyer looking at https://github.com/actions/checkout/pull/962/files and https://github.com/actions/checkout/pull/939/files there might be more to do. Although in https://github.com/actions/setup-java/pull/390/files they didn't need to do anything else.

I think for https://github.com/oss-review-toolkit/ort/actions/runs/3233029610/jobs/5294381795#step:4:2131 there are extra steps to replace: https://github.com/gradle/gradle-build-action/blob/531cc21aeb1a4bceb90b1b2807652d88734fc9ce/src/resources/init-scripts/build-result-capture.init.gradle#L54

Action and workflow authors who are using save-state or set-output via stdout should update to use the new environment files. -- https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

I think it'll be something like this:

File(System.getEnv("GITHUB_OUTPUT")) << "build-scan-url=${buildScan.buildScanUri}\n"

(unsure if \n before/after is needed, echo does add after, so I think it's being a good citizen.)

Also there are similar usages in examples: .github/workflow-samples

TWiStErRob avatar Oct 18 '22 09:10 TWiStErRob

The fix has been released as v2.3.3 (v2). Please let me know if these deprecation warnings persist.

bigdaz avatar Oct 22 '22 14:10 bigdaz

Confirmed clean Gradle builds in https://github.com/detekt/detekt/pull/5467

TWiStErRob avatar Oct 22 '22 18:10 TWiStErRob