diff --git a/.github/actions/setup_cached_java/action.yml b/.github/actions/setup_cached_java/action.yml index aaf81fd1..d82e4f80 100644 --- a/.github/actions/setup_cached_java/action.yml +++ b/.github/actions/setup_cached_java/action.yml @@ -10,31 +10,10 @@ inputs: description: "The architecture" required: true default: "amd64" - github_token: - description: "GitHub Token for triggering workflows" - required: true runs: using: composite steps: - - name: Install GitHub CLI - shell: bash - run: | - if [[ ${{ inputs.arch }} =~ "-musl" ]]; then - set -x - apk update - apk add curl git - git config --global --add safe.directory /__w/java-profiler/java-profiler - - GH_VERSION=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | grep '"tag_name":' | cut -d '"' -f 4 | sed 's/v//') - curl -L -o gh.tar.gz "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz" - tar -xzf gh.tar.gz - mv gh_${GH_VERSION}_linux_amd64/bin/gh /usr/local/bin/ - rm -rf gh_${GH_VERSION}_linux_amd64 gh.tar.gz - else - sudo apt update - sudo apt install -y gh - fi - name: Infer Build JDK shell: bash id: infer_build_jdk @@ -63,42 +42,20 @@ runs: key: jdk${{ inputs.version }}-${{ inputs.arch }}--${{ hashFiles('.github/workflows/cache_java.yml', '.github/scripts/java_setup.sh') }} restore-keys: | jdk${{ inputs.version }}-${{ inputs.arch }}-- - - name: Refresh JDK cache - if: steps.cache_jdk.outputs.cache-hit != 'true' || steps.cache_build_jdk.outputs.cache-hit != 'true' - shell: bash - env: - GH_TOKEN: ${{ inputs.github_token }} - run: | - echo "JDK cache miss detected! Triggering refresh workflow..." - gh workflow run cache_java.yml - - name: Wait for JDK cache refresh + - name: JDK cache miss if: steps.cache_jdk.outputs.cache-hit != 'true' || steps.cache_build_jdk.outputs.cache-hit != 'true' shell: bash - env: - GH_TOKEN: ${{ inputs.github_token }} run: | - while gh run list --workflow="cache_java.yml" --status="in_progress" | grep -q cache_java; do - echo "Waiting for JDK cache refresh to complete..." - sleep 10 - done - - name: Cache Build JDK [${{ inputs.arch }}] (Retry) - if: steps.cache_build_jdk.outputs.cache-hit != 'true' - uses: actions/cache/restore@v4 - with: - path: | - jdks/${{ steps.infer_build_jdk.outputs.build_jdk }} - key: ${{ steps.infer_build_jdk.outputs.build_jdk }}-${{ inputs.arch }}--${{ hashFiles('.github/workflows/cache_java.yml', '.github/scripts/java_setup.sh') }} - restore-keys: | - ${{ steps.infer_build_jdk.outputs.build_jdk }}-${{ inputs.arch }}-- - - name: Cache JDK ${{ inputs.version }} [${{ inputs.arch }}] (Retry) - if: steps.cache_jdk.outputs.cache-hit != 'true' - uses: actions/cache/restore@v4 - with: - path: | - jdks/jdk${{ inputs.version }} - key: jdk${{ inputs.version }}-${{ inputs.arch }}--${{ hashFiles('.github/workflows/cache_java.yml', '.github/scripts/java_setup.sh') }} - restore-keys: | - jdk${{ inputs.version }}-${{ inputs.arch }}-- + OWNER=${{ github.repository_owner }} + REPO=${{ github.event.repository.name }} + BRANCH=${{ github.ref_name }} + WORKFLOW="cache_java.yml" + + URL="https://github.com/$OWNER/$REPO/actions/workflows/$WORKFLOW" + + echo "### ⚠️ JDK Cache Miss Detected" >> $GITHUB_STEP_SUMMARY + echo "🛠️ [Click here and select ${BRANCH} branch to manually refresh the cache](<$URL>)" >> $GITHUB_STEP_SUMMARY + exit 1 - name: Setup Environment shell: bash run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 085bc4ce..41e7d807 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ on: permissions: contents: read pull-requests: read - actions: write + actions: read jobs: check-for-pr: diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index 65c8e839..1604be41 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -9,7 +9,7 @@ on: permissions: contents: read - actions: write + actions: read jobs: test-linux-glibc-amd64: @@ -57,7 +57,6 @@ jobs: with: version: ${{ matrix.java_version }} arch: 'amd64' - github_token: ${{ secrets.GITHUB_TOKEN }} - name: Setup OS if: steps.set_enabled.outputs.enabled == 'true' run: |