diff --git a/action.yml b/action.yml index 6415d54..3d01009 100644 --- a/action.yml +++ b/action.yml @@ -22,18 +22,26 @@ runs: ${{ github.action_path }}/set-path.sh env: scalafmt_version: ${{ inputs.version }} - - uses: actions/cache@v3 + - uses: actions/cache/restore@v4 id: cache with: path: ${{ env.SCALAFMT_PATH }} key: scalafmt-${{ inputs.version }} - shell: bash + id: retrieve-scalafmt if: ${{ !steps.cache.outputs.cache-hit }} run: | curl -sL https://github.com/scalameta/scalafmt/releases/download/v${scalafmt_version}/scalafmt-linux-glibc > "$SCALAFMT_PATH/scalafmt" chmod +x "$SCALAFMT_PATH/scalafmt" + echo "retrieved=1" >> "$GITHUB_OUTPUT" - shell: bash run: | ${{ github.action_path }}/run-scalafmt.sh env: args: ${{ inputs.args }} + - name: Cache scalafmt + if: ${{ always() && steps.cache.retrieve-scalafmt.retrieved }} + uses: actions/cache/save@v4 + with: + path: ${{ env.SCALAFMT_PATH }} + key: scalafmt-${{ inputs.version }}