# A Better Way to Use Gradle With Github Actions

DevFeed: [A Better Way to Use Gradle With Github Actions](<https://devfeed.tech/articles/a-better-way-to-use-gradle-with-github-actions-24619.md>)

Original publisher: [Read original article](<https://blog.gradle.org/gh-actions>)

Author: Daz DeBoer

Published: 2022-09-14T06:00:00Z

Content type: tutorial

Language: en

Sources: [The Gradle Blog](<https://devfeed.tech/sources/the-gradle-blog.md>)

Topics: [GitHub Actions](<https://devfeed.tech/topics/github-actions.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Caching](<https://devfeed.tech/topics/caching.md>), [GitHub](<https://devfeed.tech/topics/github.md>), [ci](<https://devfeed.tech/topics/ci.md>)

Tags: [build](<https://devfeed.tech/tags/build.md>), [caching](<https://devfeed.tech/tags/caching.md>), [ci](<https://devfeed.tech/tags/ci.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [github](<https://devfeed.tech/tags/github.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [testing](<https://devfeed.tech/tags/testing.md>), [workflow](<https://devfeed.tech/tags/workflow.md>)

## AI overview

This tutorial explains how to use the gradle-build-action to run and optimize Gradle builds in GitHub Actions. It covers Gradle installation, caching the Gradle User Home directory, and displaying build results and Gradle Build Scans.

## Source excerpt

Running Gradle builds on GitHub Actions GitHub Actions provides a convenient and powerful CI platform for projects hosted on GitHub. To enhance the experience of building Gradle projects on GitHub Actions, the Gradle team has developed the gradle-build-action. Together with Gradle Build Scans™, the gradle-build-action provides deep integration between Gradle and GitHub Actions, providing easier setup and a better experience when building and testing your Gradle project with GitHub Actions. The gradle-build-action is the officially supported way to run your Gradle build in GitHub Actions, taking care of preparing and optimizing Gradle for your GitHub Actions workflow. When applied to a workflow, all subsequent Gradle invocations will be optimized, allowing you to simply run ./gradlew build in a regular workflow step. The primary features provided by the gradle-build-action are: Download and install a specified version of Gradle (if required) Save and restore the Gradle User Home directory between workflow runs Display results and Gradle Build Scans for any Gradle build executed in your workflow Each of these features is described in more detail below. Using the Gradle Build Action It's easy to take advantage of the gradle-build-action by adding a setup step to your existing GitHub Actions workflow, similar to the way you would use the actions/setup-java action to configure a JVM for your workflow. For details on how to use the gradle-build-action in your workflow, check out the Gradle Build Tool documentation or the README. Features of the Gradle Build Action Save and restore the Gradle User Home directory between workflow runs The Gradle User Home directory persists a lot of valuable state that speeds up subsequent invocations of Gradle. Downloaded dependencies, compiled build scripts, the local Build Cache and generated API jars are all stored in the Gradle User Home. Each GitHub Actions Job runs on a fresh build runner, meaning it will start with an empty Gradle U