mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-22 17:12:51 +00:00
Avoid log messages for included builds
This commit is contained in:
parent
b69de5f2a9
commit
f59a6d4310
1 changed files with 12 additions and 15 deletions
|
@ -1,11 +1,5 @@
|
||||||
import org.gradle.util.GradleVersion
|
import org.gradle.util.GradleVersion
|
||||||
|
|
||||||
// Only run against root build. Do not run against included builds.
|
|
||||||
def isTopLevelBuild = gradle.getParent() == null
|
|
||||||
if (!isTopLevelBuild) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only run when dependency graph is explicitly enabled
|
// Only run when dependency graph is explicitly enabled
|
||||||
if (System.env.GITHUB_DEPENDENCY_GRAPH_ENABLED != "true") {
|
if (System.env.GITHUB_DEPENDENCY_GRAPH_ENABLED != "true") {
|
||||||
return
|
return
|
||||||
|
@ -18,17 +12,19 @@ if (GradleVersion.current().baseVersion < GradleVersion.version("5.0")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to find a unique job correlator to use based on the environment variable
|
// Attempt to find a unique job correlator to use based on the environment variable
|
||||||
def reportDir = System.env.GITHUB_DEPENDENCY_GRAPH_REPORT_DIR
|
// This is only required for top-level builds
|
||||||
def jobCorrelator = ensureUniqueJobCorrelator(reportDir, System.env.GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR)
|
def isTopLevelBuild = gradle.getParent() == null
|
||||||
|
if (isTopLevelBuild) {
|
||||||
|
def jobCorrelator = ensureUniqueJobCorrelator(System.env.GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR)
|
||||||
|
|
||||||
if (jobCorrelator == null) {
|
if (jobCorrelator == null) {
|
||||||
println "::warning::No dependency snapshot generated for step: report file for '${jobCorrelator}' created in earlier step. Each build invocation requires a unique job correlator: specify GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR var for this step."
|
println "::warning::No dependency snapshot generated for step: report file for '${jobCorrelator}' created in earlier step. Each build invocation requires a unique job correlator: specify GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR var for this step."
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
println "Generating dependency graph for '${jobCorrelator}'"
|
||||||
}
|
}
|
||||||
|
|
||||||
println "Generating dependency graph for '${jobCorrelator}'"
|
|
||||||
|
|
||||||
// TODO:DAZ This should be conditionally applied, since the script may be present when not required.
|
|
||||||
apply from: 'github-dependency-graph-gradle-plugin-apply.groovy'
|
apply from: 'github-dependency-graph-gradle-plugin-apply.groovy'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +33,8 @@ apply from: 'github-dependency-graph-gradle-plugin-apply.groovy'
|
||||||
* - If so, tries to find a unique value that does not yet have a corresponding report file.
|
* - If so, tries to find a unique value that does not yet have a corresponding report file.
|
||||||
* - When found, this value is set as a System property override.
|
* - When found, this value is set as a System property override.
|
||||||
*/
|
*/
|
||||||
String ensureUniqueJobCorrelator(String reportDir, String jobCorrelator) {
|
String ensureUniqueJobCorrelator(String jobCorrelator) {
|
||||||
|
def reportDir = System.env.GITHUB_DEPENDENCY_GRAPH_REPORT_DIR
|
||||||
def reportFile = new File(reportDir, jobCorrelator + ".json")
|
def reportFile = new File(reportDir, jobCorrelator + ".json")
|
||||||
if (!reportFile.exists()) return jobCorrelator
|
if (!reportFile.exists()) return jobCorrelator
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue