diff --git a/README.md b/README.md index 86c0dde..545aa7f 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,12 @@ jobs: ## Inputs -| Name | Description | Type | Default | -| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- | -| `cache-group` | The group of the cache, defaults to the job ID. If you want two jobs to share the same cache, give them the same group name. | `string` | `${{ github.job }}` | -| `cargo-home` | The location of the Cargo cache files. If you specify the `CARGO_HOME` env variable for your commands, you need to set it here too. This must NOT end with the trailing slash of the directory. | `string` | `~/.cargo` | -| `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` | +| Name | Description | Type | Default | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------- | +| `cache-group` | The group of the cache, defaults to the job ID. If you want two jobs to share the same cache, give them the same group name. | `string` | `${{ github.job }}` | +| `cargo-home` | The location of the Cargo cache files. If you specify the `CARGO_HOME` env variable for your commands, you need to set it here too. This must NOT end with the trailing slash of the directory. | `string` | `~/.cargo` | +| `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` | +| `save-always` | Run the post step to save the cache even if another step before fails. | `boolean` | `true` | ## Outputs diff --git a/action.yml b/action.yml index 7521bdb..c2086c0 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,12 @@ inputs: Defaults to `target`. required: false default: target + save-always: + description: | + Run the post step to save the cache even if another step before fails. + Defaults to `true`. + required: false + default: true outputs: cache-hit: description: | @@ -81,6 +87,7 @@ runs: id: cache uses: actions/cache@v4 with: + save-always: ${{ inputs.save-always }} path: | ${{ inputs.cargo-home }}/bin/ ${{ inputs.cargo-home }}/registry/index/