mirror of
https://github.com/actions/cache.git
synced 2025-04-20 11:06:46 +00:00
Provide better errors for unsupported event types (#68)
* Validate event type during restore * PR Feedback * Format * Linting
This commit is contained in:
parent
50a2fdee6f
commit
b7d83b4095
4 changed files with 134 additions and 3 deletions
|
@ -3,12 +3,22 @@ import { exec } from "@actions/exec";
|
|||
import * as io from "@actions/io";
|
||||
import * as path from "path";
|
||||
import * as cacheHttpClient from "./cacheHttpClient";
|
||||
import { Inputs, State } from "./constants";
|
||||
import { Events, Inputs, State } from "./constants";
|
||||
import * as utils from "./utils/actionUtils";
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
// Validate inputs, this can cause task failure
|
||||
if (!utils.isValidEvent()) {
|
||||
core.setFailed(
|
||||
`Event Validation Error: The event type ${
|
||||
process.env[Events.Key]
|
||||
} is not supported. Only ${utils
|
||||
.getSupportedEvents()
|
||||
.join(", ")} events are supported at this time.`
|
||||
);
|
||||
}
|
||||
|
||||
let cachePath = utils.resolvePath(
|
||||
core.getInput(Inputs.Path, { required: true })
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue