Merge pull request #477 from gradle/dd/issue-461

Replace use of set-output command with env file
This commit is contained in:
Daz DeBoer 2022-10-20 14:09:48 -06:00 committed by GitHub
commit 0842a550d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 9 deletions

View file

@ -11,8 +11,8 @@ dependencies {
}
tasks.named("test").configure {
// Echo an output value so we can detect configuration-cache usage
println "::set-output name=task_configured::yes"
// Write marker file so we can detect if task was configured
file("task-configured.txt").text = "true"
doLast {
if (System.properties.verifyCachedBuild) {

View file

@ -18,8 +18,8 @@ tasks.test {
}
tasks.named("test").configure {
// Echo an output value so we can detect configuration-cache usage
println("::set-output name=task_configured::yes")
// Write marker file so we can detect if task was configured
file("task-configured.txt").writeText("true")
doLast {
if (System.getProperties().containsKey("verifyCachedBuild")) {

View file

@ -60,11 +60,13 @@ jobs:
working-directory: .github/workflow-samples/groovy-dsl
run: ./gradlew test --configuration-cache
- name: Check that configuration-cache was used
if: ${{ steps.execute.outputs.task_configured == 'yes' }}
uses: actions/github-script@v6
with:
script: |
const fs = require('fs')
if (fs.existsSync('.github/workflow-samples/groovy-dsl/task-configured.txt')) {
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
}
# Check that the build can run when no extracted cache entries are restored
gradle-user-home-not-fully-restored:
@ -154,9 +156,11 @@ jobs:
working-directory: .github/workflow-samples/kotlin-dsl
run: ./gradlew test --configuration-cache
- name: Check that configuration-cache was used
if: ${{ steps.execute.outputs.task_configured == 'yes' }}
uses: actions/github-script@v6
with:
script: |
const fs = require('fs')
if (fs.existsSync('.github/workflow-samples/kotlin-dsl/task-configured.txt')) {
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
}

View file

@ -51,7 +51,10 @@ def captureUsingBuildScanPublished(buildScanExtension, rootProject, invocationId
buildResults.setBuildScanUri(buildScan.buildScanUri.toASCIIString())
buildResults.writeToResultsFile(true)
println("::set-output name=build-scan-url::${buildScan.buildScanUri}")
def githubOutput = System.getenv("GITHUB_OUTPUT")
if (githubOutput) {
new File(githubOutput) << "build-scan-url=${buildScan.buildScanUri}\n"
}
}
onError { error ->