Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate save-always #40

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
| `cargo-target-dir` | Location of where to place all generated artifacts, relative to the current working directory. If you specify the `CARGO_TARGET_DIR` env variable for your commands, you need to set it here too. This must NOT end with the trailing slash of the directory. | `string` | `target` |
|`manifest-path`|The path to `Cargo.toml`. This is used to determine where `Cargo.lock` is, which is used in the cache key.|`string`|`Cargo.toml`|
| `save-if` | A condition which determines whether the cache should be saved. Otherwise, it's only restored | `boolean` | `true` |
| `save-always` | Run the post step to save the cache even if another step before fails. | `boolean` | `true` |
| `save-always` | This input has been deprecated and will be removed in v3.0.0. It has no effect. This used to specify the `save-always` input for `actions/cache`, but has been deprecated due to its unintended behavior. If you still require this input, you will need to manually use `actions/cache`. For more information, please see <https://github.com/actions/cache/tree/v4/save#always-save-cache>. | `boolean` ||
|`sweep-cache`|Use `cargo-sweep` to automatically delete files in the target folder that are not used between when this action is called and the end of the workflow. This can prevent the size of caches steadily increasing, since new caches are generated from fallback caches that may include stale artifacts.|`boolean`|`false`|
|`cache-cargo-sweep`|This input has been deprecated and will be removed in v3.0.0. It has no effect.|`boolean`||

Expand Down
16 changes: 12 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ inputs:
default: "Cargo.toml"
save-always:
description: |
Run the post step to save the cache even if another step before fails.
Defaults to `true`.
This input has been deprecated and will be removed in v3.0.0. It has no effect.

This input used to specify the `save-always` input for `actions/cache`, but has been
deprecated due to its unintended behavior. If you still require this input, you will need
to manually use `actions/cache`. For more information, please see
<https://github.com/actions/cache/tree/v4/save#always-save-cache>.
required: false
default: "true"
save-if:
description: |
A condition to determine whether the new cache should be saved.
Expand Down Expand Up @@ -147,14 +150,19 @@ runs:
echo 'cache-group=${{ hashFiles(env.workflow_path) }}-${{ github.job }}-${{ strategy.job-index }}' >> "${GITHUB_OUTPUT}"
fi

- name: Log that `save-always` is deprecated
if: ${{ inputs.save-always }}
shell: bash
run: |
echo '::warning title=`save-always` is deprecated::`save-always` does not work as intended and will be removed in v3.0.0.'

# If the cache should also be saved, we use the cache action
# See <https://github.com/actions/cache>.
- name: Restore and save cache
id: cache
uses: actions/cache@v4
if: ${{ inputs.save-if == 'true' }}
with:
save-always: ${{ inputs.save-always }}
path: |
${{ inputs.cargo-home }}/bin/
${{ inputs.cargo-home }}/registry/index/
Expand Down