Skip to content

Commit 6fa9c84

Browse files
committed
Record dependency graph file as GitHub Step output
Previously, this has been done in an init-script in the `gradle-build-action`. However, the `GITHUB_OUTPUT` env var is different on every invocation, and reading this value will invalidate the configuration cache. Moving it to the plugin should make the plugin config-cache compatible.
1 parent 6b22903 commit 6fa9c84

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugin/src/main/kotlin/org/gradle/github/dependencygraph/GitHubDependencyGraphRenderer.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ class GitHubDependencyGraphRenderer() : DependencyGraphRenderer {
2626
val outputFile = File(outputDirectory, "${snapshotParams.dependencyGraphJobCorrelator}.json")
2727

2828
writeDependencySnapshot(snapshot, outputFile)
29+
30+
// Write the output file as a GitHub Actions step output
31+
val githubOutput = System.getenv("GITHUB_OUTPUT")
32+
if (githubOutput !== null && File(githubOutput).isFile) {
33+
File(githubOutput).appendText("dependency-graph-file=${outputFile.absolutePath}\n")
34+
}
2935
}
3036

3137
private fun writeDependencySnapshot(graph: GitHubRepositorySnapshot, manifestFile: File) {

0 commit comments

Comments
 (0)