mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 11:48:38 +08:00 
			
		
		
		
	feat: add support event type schedule
				
					
				
			This commit is contained in:
		
							parent
							
								
									60e292adf7
								
							
						
					
					
						commit
						b94f90d18f
					
				|  | @ -51,7 +51,9 @@ test("restore with invalid event outputs warning", async () => { | ||||||
|     process.env[Events.Key] = invalidEvent; |     process.env[Events.Key] = invalidEvent; | ||||||
|     await run(); |     await run(); | ||||||
|     expect(logWarningMock).toHaveBeenCalledWith( |     expect(logWarningMock).toHaveBeenCalledWith( | ||||||
|         `Event Validation Error: The event type ${invalidEvent} is not supported. Only push, pull_request events are supported at this time.` |         `Event Validation Error: The event type ${invalidEvent} is not supported. Only ${actionUtils | ||||||
|  |             .getSupportedEvents() | ||||||
|  |             .join(", ")} events are supported at this time.` | ||||||
|     ); |     ); | ||||||
|     expect(failedMock).toHaveBeenCalledTimes(0); |     expect(failedMock).toHaveBeenCalledTimes(0); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | @ -65,7 +65,9 @@ test("save with invalid event outputs warning", async () => { | ||||||
|     process.env[Events.Key] = invalidEvent; |     process.env[Events.Key] = invalidEvent; | ||||||
|     await run(); |     await run(); | ||||||
|     expect(logWarningMock).toHaveBeenCalledWith( |     expect(logWarningMock).toHaveBeenCalledWith( | ||||||
|         `Event Validation Error: The event type ${invalidEvent} is not supported. Only push, pull_request events are supported at this time.` |         `Event Validation Error: The event type ${invalidEvent} is not supported. Only ${actionUtils | ||||||
|  |             .getSupportedEvents() | ||||||
|  |             .join(", ")} events are supported at this time.` | ||||||
|     ); |     ); | ||||||
|     expect(failedMock).toHaveBeenCalledTimes(0); |     expect(failedMock).toHaveBeenCalledTimes(0); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | @ -16,5 +16,6 @@ export enum State { | ||||||
| export enum Events { | export enum Events { | ||||||
|     Key = "GITHUB_EVENT_NAME", |     Key = "GITHUB_EVENT_NAME", | ||||||
|     Push = "push", |     Push = "push", | ||||||
|     PullRequest = "pull_request" |     PullRequest = "pull_request", | ||||||
|  |     Schedule = "schedule" | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -95,7 +95,7 @@ export function resolvePath(filePath: string): string { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function getSupportedEvents(): string[] { | export function getSupportedEvents(): string[] { | ||||||
|     return [Events.Push, Events.PullRequest]; |     return [Events.Push, Events.PullRequest, Events.Schedule]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Currently the cache token is only authorized for push and pull_request events
 | // Currently the cache token is only authorized for push and pull_request events
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 bluelovers
						bluelovers