PI-2302 Fix Gradle wrapper upgrade after switch to GitHub app (#4132) #533
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: Gradle | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "30 5 * * MON-FRI" # Every weekday at 05:30 UTC | |
push: | |
paths: | |
- gradlew | |
- gradlew.bat | |
- gradle/** | |
- .github/workflows/gradle.yml | |
jobs: | |
validate-wrapper: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/actions/wrapper-validation@v4 | |
update-wrapper: | |
runs-on: ubuntu-latest | |
if: github.ref_name == 'main' | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.BOT_APP_ID }} | |
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
token: ${{ steps.app-token.outputs.token }} | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- uses: gradle-update/update-gradle-wrapper-action@0407394b9d173dfc9cf5695f9f560fef6d61a5fe # v1 | |
with: | |
labels: dependencies | |
repo-token: ${{ steps.app-token.outputs.token }} | |
- name: Reset commit author # workaround for https://github.com/gradle-update/update-gradle-wrapper-action/issues/124 | |
continue-on-error: true | |
run: | | |
if [ "$(git branch --show-current)" != main ]; then | |
git reset --soft "HEAD~$(find . -type f -name gradlew | wc -l)" | |
fi | |
- name: Commit and push | |
uses: marcus-bcl/github-app-commit-action@main # using fork while waiting for merge of https://github.com/dsanders11/github-app-commit-action/pull/20 | |
with: | |
fail-on-no-changes: false | |
force: true | |
message: Bump Gradle Wrapper to the latest version | |
token: ${{ steps.app-token.outputs.token }} |