Skip to content

Commit

Permalink
Record dependency graph file as GitHub Step output
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bigdaz committed Jan 11, 2024
1 parent 78c3c3a commit 783cdaa
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class GitHubDependencyGraphRenderer() : DependencyGraphRenderer {
val outputFile = File(outputDirectory, "${snapshotParams.dependencyGraphJobCorrelator}.json")

writeDependencySnapshot(snapshot, outputFile)

// Write the output file as a GitHub Actions step output
System.getenv("GITHUB_OUTPUT")?.let {
File(it).appendText("dependency-graph-file=${outputFile.absolutePath}\n")
}
}

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

0 comments on commit 783cdaa

Please sign in to comment.