Skip to content

Commit

Permalink
Add generate build step to avoid uncomitted changes (#14)
Browse files Browse the repository at this point in the history
* Add generate build step to avoid uncomitted changes

* Only run on ubuntu-latest

* Run spotless as seperate task

* Test change to template

* Revert "Test change to template"

This reverts commit e54077f.
  • Loading branch information
jack-berg authored Aug 31, 2023
1 parent d76b068 commit 6fe70cb
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
distribution: temurin
java-version: 17

- uses: gradle/gradle-build-action@v2
- name: build
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
Expand All @@ -53,6 +54,34 @@ jobs:
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

- name: generate
# Skip running on macos-latest which doesn't have docker
if: matrix.os == 'ubuntu-latest'
uses: gradle/gradle-build-action@v2
with:
arguments: |
generateSemanticConventions --console=plain
# Run spotless after generate to format generated code
- name: spotless
uses: gradle/gradle-build-action@v2
with:
arguments: |
spotlessApply
- name: Check for diff
run: |
# need to "git add" in case any generated files did not already exist
git add src
if git diff --cached --quiet
then
echo "No diff detected."
else
echo "Diff detected - did you run './gradlew generateSemanticConventions spotlessApply'?"
echo $(git diff --cached --name-only)
echo $(git diff --cached)
exit 1
fi
markdown-link-check:
# release branches are excluded to avoid unnecessary maintenance
if: ${{ !startsWith(github.ref_name, 'release/') }}
Expand Down

0 comments on commit 6fe70cb

Please sign in to comment.