Skip to content

Commit

Permalink
Cache scalafmt unconditionally
Browse files Browse the repository at this point in the history
It does not matter whether scalafmt passes or fails,
we want to cache scalafmt if we downloaded it.
  • Loading branch information
jsoref committed Jan 25, 2024
1 parent 31a7747 commit e30a74b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit e30a74b

Please sign in to comment.