This document shows how to use the reusable workflows in your own repositories.
Create .github/workflows/ci.yml in your repository:
name: CI
on: [push, pull_request]
jobs:
test:
uses: your-username/java-workflows/.github/workflows/java-ci-secure.yml@v1.0.0
with:
java-version: '25'
os-matrix: 'ubuntu-latest,windows-latest'
notify-on-failure: true
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}Create .github/workflows/release.yml in your repository:
name: Release
on:
push:
branches: [main]
jobs:
release:
uses: your-username/java-workflows/.github/workflows/auto-tag-enhanced.yml@v1.0.0
with:
java-version: '17'
artifact-name: 'my-app'
build-docker: true
platforms: 'linux/amd64,linux/arm64'
notify-on-success: true
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}Create .github/workflows/cleanup.yml in your repository:
name: Cleanup
on:
pull_request:
types: [closed]
jobs:
cleanup:
uses: your-username/java-workflows/.github/workflows/auto-delete-branch-enhanced.yml@v1.0.0
with:
protected-branches: 'main,develop,staging'
notify-on-deletion: true
delete-delay: 30
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}Create .github/workflows/dependabot.yml in your repository:
name: Dependabot
on:
pull_request:
types: [opened, synchronize]
jobs:
auto-merge:
uses: your-username/java-workflows/.github/workflows/dependabot-auto-merge-enhanced.yml@v1.0.0
with:
auto-merge-patch: true
auto-merge-minor: true
auto-merge-major: false
exclude-dependencies: 'spring-boot,junit'
require-ci-success: true
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}steps:
- uses: actions/checkout@v4
- uses: your-username/java-workflows/.github/actions/setup-java-maven@v1.0.0
with:
java-version: '25'
maven-version: '3.8.8'steps:
- uses: actions/checkout@v4
- uses: your-username/java-workflows/.github/actions/docker-build-push@v1.0.0
with:
image-name: 'my-app'
image-tag: 'v1.0.0'
registry: 'ghcr.io'
push: 'true'
platforms: 'linux/amd64,linux/arm64'GITHUB_TOKEN: Automatically provided by GitHub
SLACK_WEBHOOK_URL: Your Slack webhook URL for notifications
java-version: Java version (8, 11, 17, 21, 23, 25)os-matrix: Operating systems to test onmaven-opts: Maven JVM optionstest-pattern: Test pattern for Mavennotify-on-failure: Send notifications on failure
java-version: Java versionartifact-name: Name of the built artifactbuild-docker: Whether to build Docker imagerun-tests: Whether to run tests before taggingregistry: Container registry URLplatforms: Docker platforms to build
auto-merge-patch: Enable auto-merge for patch updatesauto-merge-minor: Enable auto-merge for minor updatesauto-merge-major: Enable auto-merge for major updatesmerge-method: Merge method (merge, squash, rebase)exclude-dependencies: Dependencies to exclude from auto-merge
protected-branches: Branches never to deleteadd-comment: Whether to comment on PR after deletionnotify-on-deletion: Send notifications when branches are deleteddry-run: Only simulate deletiondelete-delay: Delay in seconds before deletion
- Always reference by tag: Use
@v1.0.0instead of@main - Use semantic versioning: Major.Minor.Patch
- Test workflows: Use the test-workflows.yml pipeline
- Monitor notifications: Set up Slack webhooks
- Regular updates: Keep dependencies current
- Workflow not found: Make sure you're using the correct repository name and tag
- Permission denied: Ensure the workflow has the required permissions
- Secrets not found: Make sure all required secrets are configured
- YAML syntax errors: Validate your workflow files
- Check the workflow run logs for detailed error messages
- Verify all required inputs are provided
- Ensure all required secrets are configured
- Test with a simple workflow first
If you encounter issues:
- Check the workflow documentation in the README
- Review the workflow source code
- Open an issue in this repository
- Check the GitHub Actions documentation