github-workflow-gradle-template
Provides a GitHub Actions CI workflow template for Gradle/Java projects. Claude should use this skill when creating or updating CI workflows to ensure current action versions and best practices are followed.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
GitHub Actions Workflow Template for Gradle Projects
When creating a GitHub Actions CI workflow for a Gradle/Java project, use this template:
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
- name: Build with Gradle
run: ./gradlew build
Key Points
-
Action versions (as of December 2025):
-
actions/checkout@v4 -
actions/setup-java@v4 -
gradle/actions/setup-gradle@v4
-
-
Do NOT use deprecated actions:
-
gradle/wrapper-validation-action- no longer needed, wrapper validation is included ingradle/actions/setup-gradle -
gradle/gradle-build-action- replaced bygradle/actions/setup-gradle
-
-
Avoid redundant steps:
-
./gradlew buildalready runs tests, so a separate./gradlew teststep is unnecessary
-
-
Gradle caching: The
gradle/actions/setup-gradleaction handles caching automatically. Usecache-read-only: falseto allow cache writes.
Customization
Adjust as needed for your project:
- Change
java-versionif using a different JDK version - Add additional branches to the trigger
- Add environment variables or secrets as required
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-03-11
- Index updated
- 2026-03-11
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!