From 4d9f8dd2446598146fb5322ac6dd412ac74bec27 Mon Sep 17 00:00:00 2001 From: wchen342 Date: Fri, 15 May 2026 11:42:18 -0400 Subject: [PATCH] Update pinned commits; Remove separate PR comment workflow (#4434) --- .github/workflows/artifacts.yml | 26 -------------------------- .github/workflows/cache-core.yml | 4 ++-- .github/workflows/code-format.yml | 16 +++++++++++++--- .github/workflows/preview-apk.yml | 29 ++++++++++++++++++++++++----- .github/workflows/zizmor-scan.yml | 2 +- 5 files changed, 40 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/artifacts.yml diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml deleted file mode 100644 index f0b819ed8..000000000 --- a/.github/workflows/artifacts.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: add artifact links to pull request -on: - workflow_run: - workflows: ["Upload Preview APK"] - types: [completed] - -permissions: {} - -jobs: - artifacts-url-comments: - name: add artifact links to pull request - permissions: - pull-requests: write - actions: read - contents: read - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: add artifact links to pull request - uses: tonyhallett/artifacts-url-comments@0965ff1a7ae03c5c1644d3c30f956effea4e05ef # v1.1.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - prefix: "**To test the changes in this pull request, install this apk:**" - format: "[📦 {name}]({url})" - addTo: pull diff --git a/.github/workflows/cache-core.yml b/.github/workflows/cache-core.yml index 8db29fcf9..7c7b20df7 100644 --- a/.github/workflows/cache-core.yml +++ b/.github/workflows/cache-core.yml @@ -16,7 +16,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: submodules: recursive persist-credentials: false @@ -37,7 +37,7 @@ jobs: - name: Cache compiled core id: cache-core - uses: actions/cache@v4 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | jni/arm64-v8a diff --git a/.github/workflows/code-format.yml b/.github/workflows/code-format.yml index 2eb46e769..c5ef11cd1 100644 --- a/.github/workflows/code-format.yml +++ b/.github/workflows/code-format.yml @@ -18,14 +18,16 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - uses: actions/setup-java@v5 + - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 with: java-version: 17 distribution: temurin - - uses: actions/cache@v4 + - name: Restore Gradle cache + id: gradle-cache + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | ~/.gradle/caches @@ -37,3 +39,11 @@ jobs: uses: gradle/actions/wrapper-validation@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 - name: Check formatting run: ./gradlew spotlessCheck + - name: Save Gradle cache + if: github.event_name == 'push' && steps.gradle-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} diff --git a/.github/workflows/preview-apk.yml b/.github/workflows/preview-apk.yml index 7dd8fe178..7ff63fc93 100644 --- a/.github/workflows/preview-apk.yml +++ b/.github/workflows/preview-apk.yml @@ -11,19 +11,23 @@ permissions: {} jobs: build: name: Upload Preview APK + if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: submodules: recursive persist-credentials: false - - uses: actions/setup-java@v5 + - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 with: java-version: 17 distribution: 'temurin' - - uses: actions/cache@v4 + - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | ~/.gradle/caches @@ -51,7 +55,7 @@ jobs: - name: Restore compiled core id: core-cache - uses: actions/cache/restore@v4 + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: | jni/arm64-v8a @@ -70,7 +74,22 @@ jobs: run: ./gradlew --no-daemon -PABI_FILTER=arm64-v8a assembleGplayDebug - name: Upload APK - uses: actions/upload-artifact@v4 + id: upload + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: app-preview.apk path: 'build/outputs/apk/gplay/debug/*.apk' + + - name: Add artifact links to PR + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + ARTIFACT_URL: ${{ steps.upload.outputs.artifact-url }} + with: + script: | + const url = process.env.ARTIFACT_URL; + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: `**To test the changes in this pull request, install this apk:**\n\n[📦 app-preview.apk](${url})`, + }); diff --git a/.github/workflows/zizmor-scan.yml b/.github/workflows/zizmor-scan.yml index af97e663b..8811efe96 100644 --- a/.github/workflows/zizmor-scan.yml +++ b/.github/workflows/zizmor-scan.yml @@ -18,7 +18,7 @@ jobs: actions: read steps: - name: Checkout repository - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false