diff --git a/.github/actions/preload-magisk-cache/action.yml b/.github/actions/preload-magisk-cache/action.yml index dd835a6..a83676f 100644 --- a/.github/actions/preload-magisk-cache/action.yml +++ b/.github/actions/preload-magisk-cache/action.yml @@ -1,7 +1,7 @@ name: Preload Magisk inputs: - hash: - description: 'Magisk hash' + cache-key: + description: 'Magisk cache-key' required: true url: description: 'Magisk URL' @@ -13,7 +13,7 @@ runs: - uses: actions/cache@v3 id: cache-magisk with: - key: magisk-${{ inputs.hash }} + key: ${{ inputs.cache-key }} path: | workdir/magisk.apk - name: Creating workdir diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 724b75a..e79838d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: outputs: device-db: ${{ steps.load-db.outputs.device-db }} device-list: ${{ steps.load-db.outputs.device-list }} - magisk-hash: ${{ steps.load-db.outputs.magisk-hash }} + magisk-key: ${{ steps.get-magisk-cache.outputs.magisk-key }} magisk-url: ${{ steps.load-db.outputs.magisk-url }} img-to-cache: ${{ steps.load-db.outputs.img-to-cache }} hit-magisk: ${{ fromJSON(steps.get-magisk-cache.outputs.magisk-hit).total_count != 0 }} @@ -78,17 +78,19 @@ jobs: with open(os.environ['GITHUB_OUTPUT'], 'a') as f: f.write(f"device-db={db['device']}" + '\n') f.write(f"device-list={[i for i in db['device']]}" + '\n') - f.write(f"magisk-hash={db['magisk']['sha256']}" + '\n') f.write(f"magisk-url={db['magisk']['url']}" + '\n') f.write(f"img-to-cache={devices_to_cache}" + '\n') - name: Checking for cached magisk apk id: get-magisk-cache + env: + magisk-key: magisk-${{ hashFiles(env.test-db-path) }} run: | + echo "magisk-key=${{ env.magisk-key }}" >> $GITHUB_OUTPUT echo "magisk-hit=$(gh api \ --method GET \ -H 'Accept: application/vnd.github+json' \ -H 'X-GitHub-Api-Version: 2022-11-28' \ - -f 'key=magisk-${{ steps.load-db.outputs.magisk-hash }}' \ + -f 'key=${{ env.magisk-key }}' \ /repos/${{ github.repository }}/actions/caches)" >> $GITHUB_OUTPUT preload-magisk: @@ -101,7 +103,7 @@ jobs: - uses: actions/checkout@v3 - uses: ./.github/actions/preload-magisk-cache with: - hash: ${{ needs.setup.outputs.magisk-hash }} + cache-key: ${{ needs.setup.outputs.magisk-key }} url: ${{ needs.setup.outputs.magisk-url }} preload-img: @@ -161,7 +163,7 @@ jobs: submodules: true - uses: ./.github/actions/preload-magisk-cache with: - hash: ${{ needs.setup.outputs.magisk-hash }} + cache-key: ${{ needs.setup.outputs.magisk-key }} url: ${{ needs.setup.outputs.magisk-url }} - uses: ./.github/actions/preload-img-cache with: