mirror of
https://github.com/actions/stale.git
synced 2025-12-27 20:22:48 +08:00
Rename ActionCache to ActionsCache
This commit is contained in:
@@ -45,7 +45,7 @@ const getCacheArchiveUrl = async (
|
||||
return cacheDownloadUrl;
|
||||
};
|
||||
|
||||
export const downloadFileFromActionCache = async (
|
||||
export const downloadFileFromActionsCache = async (
|
||||
destFileName: string,
|
||||
cacheKey: string,
|
||||
cacheVersion: string
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from 'path';
|
||||
import os from 'os';
|
||||
import * as core from '@actions/core';
|
||||
import {uploadFileToActionsCache} from '../actions-cache/upload';
|
||||
import {downloadFileFromActionCache} from '../actions-cache/download';
|
||||
import {downloadFileFromActionsCache} from '../actions-cache/download';
|
||||
|
||||
const CACHE_KEY = '_state';
|
||||
const CACHE_VERSION = '1';
|
||||
@@ -30,10 +30,10 @@ export class StateCacheStorage implements IStateStorage {
|
||||
const tmpDir = fs.mkdtempSync('state-');
|
||||
const fileName = path.join(tmpDir, STATE_FILE);
|
||||
try {
|
||||
await downloadFileFromActionCache(fileName, CACHE_KEY, CACHE_VERSION);
|
||||
await downloadFileFromActionsCache(fileName, CACHE_KEY, CACHE_VERSION);
|
||||
if (!fs.existsSync(fileName)) {
|
||||
core.info(
|
||||
'There is no state persisted, probably because of the very first run or previous run failed'
|
||||
'The stored state has not been found, probably because of the very first run or the previous run failed'
|
||||
);
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ describe('State', () => {
|
||||
mockStorage,
|
||||
{} as unknown as IIssuesProcessorOptions
|
||||
);
|
||||
await state.rehydrate();
|
||||
await state.restore();
|
||||
const processedIssuesIDs = (
|
||||
state as unknown as {processedIssuesIDs: Set<IssueID>}
|
||||
).processedIssuesIDs;
|
||||
|
||||
@@ -60,7 +60,7 @@ export class State implements IState {
|
||||
return this.stateStorage.save(this.serialized);
|
||||
}
|
||||
|
||||
async rehydrate(): Promise<void> {
|
||||
async restore(): Promise<void> {
|
||||
this.reset();
|
||||
const serialized = await this.stateStorage.restore();
|
||||
this.deserialize(serialized);
|
||||
|
||||
@@ -5,5 +5,5 @@ export interface IState {
|
||||
addIssueToProcessed(issue: IIssue): void;
|
||||
reset(): void;
|
||||
persist(): Promise<void>;
|
||||
rehydrate(): Promise<void>;
|
||||
restore(): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ async function _run(): Promise<void> {
|
||||
const args = _getAndValidateArgs();
|
||||
|
||||
const state = getStateInstance(args);
|
||||
await state.rehydrate();
|
||||
await state.restore();
|
||||
|
||||
const issueProcessor: IssuesProcessor = new IssuesProcessor(args, state);
|
||||
await issueProcessor.processIssues();
|
||||
|
||||
Reference in New Issue
Block a user