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

feat: save cache on job failure #16

Merged
merged 1 commit into from
Feb 20, 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
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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/
Expand Down