Add workflow to auto-update codegen #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Generation | |
on: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * 1' # 00:00 UTC Weekly on Mondays | |
jobs: | |
up_to_date: | |
name: Ensure Generated Code Up To Date | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Java Client | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Download Latest Spec | |
# if: github.event_name == 'schedule' | |
run: ./gradlew :java-codegen:downloadLatestSpec | |
- name: Run Code Generator | |
run: ./gradlew :java-codegen:run | |
- name: Git Status | |
id: git_status | |
shell: bash -eo pipefail {0} | |
run: | | |
output=$(git status --porcelain) | |
if [ -z "$output" ]; then | |
echo "Clean working directory" | |
echo "clean=true" >> $GITHUB_OUTPUT | |
else | |
echo "Dirty working directory" | |
echo "$output" | |
echo "clean=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Fail On Uncommitted Changes | |
if: github.event_name != 'schedule' && steps.git_status.outputs.clean != 'true' | |
run: exit 1 |