mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-16 16:01:22 +02:00
Linting
This commit is contained in:
parent
7c937ff3b3
commit
38a34c1c26
3 changed files with 9 additions and 9 deletions
|
@ -302,7 +302,7 @@ test("restore with a pull request event and cache found", async () => {
|
|||
archiveLocation: "https://www.example.com/download"
|
||||
};
|
||||
const getCacheMock = jest.spyOn(cacheHttpClient, "getCacheEntry");
|
||||
getCacheMock.mockImplementation(_ => {
|
||||
getCacheMock.mockImplementation(() => {
|
||||
return Promise.resolve(cacheEntry);
|
||||
});
|
||||
const tempPath = "/foo/bar";
|
||||
|
|
|
@ -13,8 +13,8 @@ export enum State {
|
|||
CacheResult = "CACHE_RESULT"
|
||||
}
|
||||
|
||||
export namespace Events {
|
||||
export const Key = "GITHUB_EVENT_NAME";
|
||||
export const Push = "push";
|
||||
export const PullRequest = "pull_request";
|
||||
export enum Events {
|
||||
Key = "GITHUB_EVENT_NAME",
|
||||
Push = "push",
|
||||
PullRequest = "pull_request"
|
||||
}
|
||||
|
|
|
@ -85,6 +85,10 @@ export function resolvePath(filePath: string): string {
|
|||
return path.resolve(filePath);
|
||||
}
|
||||
|
||||
export function getSupportedEvents(): string[] {
|
||||
return [Events.Push, Events.PullRequest];
|
||||
}
|
||||
|
||||
// Currently the cache token is only authorized for push and pull_request events
|
||||
// All other events will fail when reading and saving the cache
|
||||
// See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
|
||||
|
@ -92,7 +96,3 @@ export function isValidEvent(): boolean {
|
|||
const githubEvent = process.env[Events.Key] || "";
|
||||
return getSupportedEvents().includes(githubEvent);
|
||||
}
|
||||
|
||||
export function getSupportedEvents(): string[] {
|
||||
return [Events.Push, Events.PullRequest];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue