Add test file in current directory

This commit is contained in:
Jimver
2025-06-04 19:50:45 +00:00
parent d3ae05e19d
commit 28418509c8
+16
View File
@@ -96,6 +96,13 @@ export async function download(
testFilePath,
`This is a test file to verify that the cache directory is working correctly.`
)
//create test file in current directory
const testFileCurrentPath = `test.txt`
core.debug(`Creating test file at ${testFileCurrentPath}`)
await fs.promises.writeFile(
testFileCurrentPath,
`This is a test file to verify that the current directory is working correctly.`
)
// Get absolute path to the cache directory
const absoluteCacheDirectory = await fs.promises.realpath(cacheDirectory)
core.debug(`Absolute path to cache directory: ${absoluteCacheDirectory}`)
@@ -113,6 +120,15 @@ export async function download(
core.debug(
`Files in cache directory (glob): ${cacheDirectory}: ${filesInCacheDirectoryGlob}`
)
// List files in current directory using fs.promises
const filesInCurrentDirectory = await fs.promises.readdir('.')
core.debug(`Files in current directory: ${filesInCurrentDirectory}`)
// List files in current directory using glob
const globberCurrent = await glob.create(`./*`)
const filesInCurrentDirectoryGlob = await globberCurrent.glob()
core.debug(
`Files in current directory (glob): ${filesInCurrentDirectoryGlob}`
)
// Save cache directory to GitHub cache
const cacheId = await cache.saveCache([cacheDirectory], cacheKey)
if (cacheId !== -1) {