From c3b2615c0039cbebff01f522c311128ba90dd8f6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 15:09:38 +0000 Subject: [PATCH 1/6] Initial plan From 20c5e9199106525ee9a6aa73e2d5b82d4213053c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 15:11:59 +0000 Subject: [PATCH 2/6] Add gradle wrapper update workflow Co-authored-by: mmathieum <177998+mmathieum@users.noreply.github.com> --- .github/workflows/gradle-wrapper-update.yml | 112 ++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .github/workflows/gradle-wrapper-update.yml diff --git a/.github/workflows/gradle-wrapper-update.yml b/.github/workflows/gradle-wrapper-update.yml new file mode 100644 index 00000000..398c0478 --- /dev/null +++ b/.github/workflows/gradle-wrapper-update.yml @@ -0,0 +1,112 @@ +name: MT Update Gradle Wrapper +on: + workflow_dispatch: # manual + inputs: + gradle-version: + description: 'Gradle version to update to (e.g., 8.13)' + required: true + type: string + gradle-distribution-sha256-sum: + description: 'SHA256 checksum of the Gradle distribution (find at https://gradle.org/release-checksums/)' + required: true + type: string +# gh workflow run gradle-wrapper-update.yml --ref -f gradle-version=8.13 -f gradle-distribution-sha256-sum= +# gh run list --workflow=gradle-wrapper-update.yml +env: + MT_BOT_USER_NAME: ${{ vars.MT_BOT_USER_NAME }} + MT_BOT_USER_EMAIL: ${{ vars.MT_BOT_USER_EMAIL }} + MT_BRANCH_NAME: ${{ github.head_ref || github.ref_name }} +jobs: + MT-UPDATE-GRADLE-WRAPPER-JOB: + name: "MT Update Gradle wrapper" + runs-on: ubuntu-latest + steps: + - name: MT select main repo checkout branch + id: mt-pick-main-repo-checkout-branch + env: + GH_TOKEN: ${{ github.token }} + run: | + MAIN_REPO_URL="https://github.com/mtransitapps/mtransit-for-android.git" + BRANCH_EXISTS=$(git ls-remote --heads $MAIN_REPO_URL $MT_BRANCH_NAME | wc -l); + if [ $BRANCH_EXISTS -eq 1 ]; then + CHECKOUT_BRANCH=$MT_BRANCH_NAME + else + echo "WARNING: no match for current branch!!!" + DEFAULT_REPO_BRANCH=$(gh api repos/mtransitapps/mtransit-for-android --jq '.default_branch'); + CHECKOUT_BRANCH=$DEFAULT_REPO_BRANCH + fi + echo "Checkout branch: '$CHECKOUT_BRANCH'." + echo "mt_checkout_branch=$CHECKOUT_BRANCH" >> "$GITHUB_OUTPUT" + - name: MT check out main repo + uses: actions/checkout@v6 + with: + repository: mtransitapps/mtransit-for-android + ref: ${{ steps.mt-pick-main-repo-checkout-branch.outputs.mt_checkout_branch }} + submodules: true + token: ${{ secrets.MT_PAT || secrets.GITHUB_TOKEN }} + fetch-depth: 0 + - name: MT check out submodules + run: ./checkout_submodules.sh + - name: MT check out this module repo branch + run: | + REPOSITORY_OWNER_AND_NAME=${{ github.repository }}; + REPOSITORY_NAME=$(basename $REPOSITORY_OWNER_AND_NAME); + echo "Repository name: '$REPOSITORY_NAME'." + echo "Fetching from repo '$REPOSITORY_NAME':" + git -C $REPOSITORY_NAME fetch -v --all; + echo "Checking out this repo '$REPOSITORY_NAME' workflow branch '$MT_BRANCH_NAME':" + git -C $REPOSITORY_NAME switch $MT_BRANCH_NAME; + echo "Pulling from repo '$REPOSITORY_NAME':" + git -C $REPOSITORY_NAME pull -v; + - name: MT setup + run: ./.github/actions/setup/run.sh + - name: MT set up JDK 17 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '17' + - name: MT update gradle wrapper + run: | + echo "Updating Gradle wrapper to version ${{ inputs.gradle-version }}..." + ./gradlew wrapper --gradle-version ${{ inputs.gradle-version }} --gradle-distribution-sha256-sum=${{ inputs.gradle-distribution-sha256-sum }} + echo "Gradle wrapper updated successfully." + - name: MT copy gradle files to commons/shared + run: | + echo "Copying gradle files to commons/shared/..." + cp -R ./gradle* commons/shared/ + echo "Files copied successfully." + echo "Verifying copied files:" + ls -la commons/shared/gradle* + - name: MT commit and push changes + run: | + cd commons || exit; + git config user.name "$MT_BOT_USER_NAME"; + git config user.email "$MT_BOT_USER_EMAIL"; + git add -v shared/gradle*; + git diff --staged --quiet || git commit -m "Update Gradle wrapper to ${{ inputs.gradle-version }}"; + git push; + cd .. || exit; + - name: MT create pull request + env: + GH_TOKEN: ${{ secrets.MT_PAT || secrets.GITHUB_TOKEN }} + run: | + cd commons || exit; + PR_TITLE="Update Gradle wrapper to ${{ inputs.gradle-version }}" + PR_BODY="This PR updates the Gradle wrapper to version ${{ inputs.gradle-version }}. + + **Gradle Version:** ${{ inputs.gradle-version }} + **SHA256 Checksum:** ${{ inputs.gradle-distribution-sha256-sum }} + + Generated by workflow: ${{ github.workflow }} + Triggered by: @${{ github.actor }}" + # Check if PR already exists + EXISTING_PR=$(gh pr list --head "$MT_BRANCH_NAME" --json number --jq '.[0].number' || echo "") + + if [ -n "$EXISTING_PR" ]; then + echo "Pull request #$EXISTING_PR already exists for branch $MT_BRANCH_NAME" + gh pr view $EXISTING_PR + else + echo "Creating pull request..." + gh pr create --title "$PR_TITLE" --body "$PR_BODY" --head "$MT_BRANCH_NAME" || echo "PR creation failed or PR already exists" + fi + cd .. || exit; From b8cb78b7271988510322ae9a8c61e433d470135b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 15:13:24 +0000 Subject: [PATCH 3/6] Fix exit codes in workflow to explicitly return 1 on error Co-authored-by: mmathieum <177998+mmathieum@users.noreply.github.com> --- .github/workflows/gradle-wrapper-update.yml | 8 ++++---- .gradle/8.13/checksums/checksums.lock | Bin 0 -> 17 bytes .../8.13/executionHistory/executionHistory.lock | Bin 0 -> 17 bytes .gradle/8.13/fileChanges/last-build.bin | Bin 0 -> 1 bytes .gradle/8.13/fileHashes/fileHashes.lock | Bin 0 -> 17 bytes .gradle/8.13/gc.properties | 0 .gradle/buildOutputCleanup/buildOutputCleanup.lock | Bin 0 -> 17 bytes .gradle/buildOutputCleanup/cache.properties | 2 ++ .gradle/vcs-1/gc.properties | 0 9 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .gradle/8.13/checksums/checksums.lock create mode 100644 .gradle/8.13/executionHistory/executionHistory.lock create mode 100644 .gradle/8.13/fileChanges/last-build.bin create mode 100644 .gradle/8.13/fileHashes/fileHashes.lock create mode 100644 .gradle/8.13/gc.properties create mode 100644 .gradle/buildOutputCleanup/buildOutputCleanup.lock create mode 100644 .gradle/buildOutputCleanup/cache.properties create mode 100644 .gradle/vcs-1/gc.properties diff --git a/.github/workflows/gradle-wrapper-update.yml b/.github/workflows/gradle-wrapper-update.yml index 398c0478..8e6d7a8a 100644 --- a/.github/workflows/gradle-wrapper-update.yml +++ b/.github/workflows/gradle-wrapper-update.yml @@ -79,18 +79,18 @@ jobs: ls -la commons/shared/gradle* - name: MT commit and push changes run: | - cd commons || exit; + cd commons || exit 1; git config user.name "$MT_BOT_USER_NAME"; git config user.email "$MT_BOT_USER_EMAIL"; git add -v shared/gradle*; git diff --staged --quiet || git commit -m "Update Gradle wrapper to ${{ inputs.gradle-version }}"; git push; - cd .. || exit; + cd .. || exit 1; - name: MT create pull request env: GH_TOKEN: ${{ secrets.MT_PAT || secrets.GITHUB_TOKEN }} run: | - cd commons || exit; + cd commons || exit 1; PR_TITLE="Update Gradle wrapper to ${{ inputs.gradle-version }}" PR_BODY="This PR updates the Gradle wrapper to version ${{ inputs.gradle-version }}. @@ -109,4 +109,4 @@ jobs: echo "Creating pull request..." gh pr create --title "$PR_TITLE" --body "$PR_BODY" --head "$MT_BRANCH_NAME" || echo "PR creation failed or PR already exists" fi - cd .. || exit; + cd .. || exit 1; diff --git a/.gradle/8.13/checksums/checksums.lock b/.gradle/8.13/checksums/checksums.lock new file mode 100644 index 0000000000000000000000000000000000000000..b4f35fce88a504cdb79d5e19ea7a67b0ff5c5207 GIT binary patch literal 17 ScmZS1=?N`0?zdB5fC2y|@~ literal 0 HcmV?d00001 diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 00000000..c6971162 --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Wed Feb 04 15:12:47 UTC 2026 +gradle.version=8.13 diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 00000000..e69de29b From 4a64e9a4ec9df93e06475a0986a476041fec10d6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 15:13:57 +0000 Subject: [PATCH 4/6] Remove accidentally committed .gradle build artifacts and update .gitignore Co-authored-by: mmathieum <177998+mmathieum@users.noreply.github.com> --- .gitignore | 3 +++ .gradle/8.13/checksums/checksums.lock | Bin 17 -> 0 bytes .../8.13/executionHistory/executionHistory.lock | Bin 17 -> 0 bytes .gradle/8.13/fileChanges/last-build.bin | Bin 1 -> 0 bytes .gradle/8.13/fileHashes/fileHashes.lock | Bin 17 -> 0 bytes .gradle/8.13/gc.properties | 0 .gradle/buildOutputCleanup/buildOutputCleanup.lock | Bin 17 -> 0 bytes .gradle/buildOutputCleanup/cache.properties | 2 -- .gradle/vcs-1/gc.properties | 0 9 files changed, 3 insertions(+), 2 deletions(-) delete mode 100644 .gradle/8.13/checksums/checksums.lock delete mode 100644 .gradle/8.13/executionHistory/executionHistory.lock delete mode 100644 .gradle/8.13/fileChanges/last-build.bin delete mode 100644 .gradle/8.13/fileHashes/fileHashes.lock delete mode 100644 .gradle/8.13/gc.properties delete mode 100644 .gradle/buildOutputCleanup/buildOutputCleanup.lock delete mode 100644 .gradle/buildOutputCleanup/cache.properties delete mode 100644 .gradle/vcs-1/gc.properties diff --git a/.gitignore b/.gitignore index 4b3d9e28..d2b18a2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ # IntelliJ *.iml +# Gradle +.gradle/ + # TOML Dependency updater file *.updates.toml \ No newline at end of file diff --git a/.gradle/8.13/checksums/checksums.lock b/.gradle/8.13/checksums/checksums.lock deleted file mode 100644 index b4f35fce88a504cdb79d5e19ea7a67b0ff5c5207..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17 ScmZS1=?N`0?zdB5fC2y|@~ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties deleted file mode 100644 index c6971162..00000000 --- a/.gradle/buildOutputCleanup/cache.properties +++ /dev/null @@ -1,2 +0,0 @@ -#Wed Feb 04 15:12:47 UTC 2026 -gradle.version=8.13 diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties deleted file mode 100644 index e69de29b..00000000 From 4d8af442ea70093459b5335118b3f4bd01dc179e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 15:15:05 +0000 Subject: [PATCH 5/6] Add explicit permissions to workflow for security Co-authored-by: mmathieum <177998+mmathieum@users.noreply.github.com> --- .github/workflows/gradle-wrapper-update.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/gradle-wrapper-update.yml b/.github/workflows/gradle-wrapper-update.yml index 8e6d7a8a..f23de8af 100644 --- a/.github/workflows/gradle-wrapper-update.yml +++ b/.github/workflows/gradle-wrapper-update.yml @@ -20,6 +20,9 @@ jobs: MT-UPDATE-GRADLE-WRAPPER-JOB: name: "MT Update Gradle wrapper" runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - name: MT select main repo checkout branch id: mt-pick-main-repo-checkout-branch From e750d0c4987e733c515c8f8e4911c46e62214bbe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 15:15:53 +0000 Subject: [PATCH 6/6] Use explicit file paths instead of wildcards when copying gradle files Co-authored-by: mmathieum <177998+mmathieum@users.noreply.github.com> --- .github/workflows/gradle-wrapper-update.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle-wrapper-update.yml b/.github/workflows/gradle-wrapper-update.yml index f23de8af..d6385cf8 100644 --- a/.github/workflows/gradle-wrapper-update.yml +++ b/.github/workflows/gradle-wrapper-update.yml @@ -76,10 +76,12 @@ jobs: - name: MT copy gradle files to commons/shared run: | echo "Copying gradle files to commons/shared/..." - cp -R ./gradle* commons/shared/ + cp -R ./gradle commons/shared/ + cp ./gradlew commons/shared/ + cp ./gradlew.bat commons/shared/ echo "Files copied successfully." echo "Verifying copied files:" - ls -la commons/shared/gradle* + ls -la commons/shared/gradle commons/shared/gradlew* - name: MT commit and push changes run: | cd commons || exit 1;