From ee5fe7718d7617699bfda5af74feab4ff4ff3e7b Mon Sep 17 00:00:00 2001 From: Konrad Pabjan Date: Tue, 14 Jul 2020 12:20:40 +0200 Subject: [PATCH 1/4] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9be1d28..0233186 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Test on: push: branches: - - master + - main paths-ignore: - '**.md' pull_request: From 8ec57c93cb3b1ac57041867f31f3d25af8336753 Mon Sep 17 00:00:00 2001 From: Konrad Pabjan Date: Tue, 14 Jul 2020 12:25:21 +0200 Subject: [PATCH 2/4] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cabcd5d..1f1e3eb 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ steps: !path/**/*.tmp ``` -For supported wildcards along with behavior and documentation, see [@actions/glob](https://github.com/actions/toolkit/tree/master/packages/glob) which is used internally to search for files. +For supported wildcards along with behavior and documentation, see [@actions/glob](https://github.com/actions/toolkit/tree/main/packages/glob) which is used internally to search for files. If a wildcard pattern is used, the path hierarchy will be preserved after the first wildcard pattern. @@ -86,7 +86,7 @@ If multiple paths are provided as input, the least common ancestor of all the se Relative and absolute file paths are both allowed. Relative paths are rooted against the current working directory. Paths that begin with a wildcard character should be quoted to avoid being interpreted as YAML aliases. -The [@actions/artifact](https://github.com/actions/toolkit/tree/master/packages/artifact) package is used internally to handle most of the logic around uploading an artifact. There is extra documentation around upload limitations and behavior in the toolkit repo that is worth checking out. +The [@actions/artifact](https://github.com/actions/toolkit/tree/main/packages/artifact) package is used internally to handle most of the logic around uploading an artifact. There is extra documentation around upload limitations and behavior in the toolkit repo that is worth checking out. ### Conditional Artifact Upload From 589ca5fbdd432d7e4f377aced7a8752631dad642 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2020 12:45:55 +0200 Subject: [PATCH 3/4] Bump lodash from 4.17.15 to 4.17.19 (#99) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d217fbd..61facf7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7975,9 +7975,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "lodash.memoize": { From 5f948bc1f0a251f88bb4c9b1c3dfa6cbd1327dc5 Mon Sep 17 00:00:00 2001 From: Konrad Pabjan Date: Mon, 27 Jul 2020 15:41:16 +0200 Subject: [PATCH 4/4] Correctly check symlinks (#103) --- dist/index.js | 6 +++++- src/search.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 85179f2..4208115 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6225,6 +6225,8 @@ const path = __importStar(__webpack_require__(622)); const core_1 = __webpack_require__(470); const fs_1 = __webpack_require__(747); const path_1 = __webpack_require__(622); +const util_1 = __webpack_require__(669); +const stats = util_1.promisify(fs_1.stat); function getDefaultGlobOptions() { return { followSymbolicLinks: true, @@ -6293,7 +6295,9 @@ function findFilesToUpload(searchPath, globOptions) { directories so filter any directories out from the raw search results */ for (const searchResult of rawSearchResults) { - if (!fs_1.lstatSync(searchResult).isDirectory()) { + const fileStats = yield stats(searchResult); + // isDirectory() returns false for symlinks if using fs.lstat(), make sure to use fs.stat() instead + if (!fileStats.isDirectory()) { core_1.debug(`File:${searchResult} was found using the provided searchPath`); searchResults.push(searchResult); } diff --git a/src/search.ts b/src/search.ts index f507f40..5a4911a 100644 --- a/src/search.ts +++ b/src/search.ts @@ -1,8 +1,10 @@ import * as glob from '@actions/glob' import * as path from 'path' import {debug, info} from '@actions/core' -import {lstatSync} from 'fs' +import {stat} from 'fs' import {dirname} from 'path' +import {promisify} from 'util' +const stats = promisify(stat) export interface SearchResult { filesToUpload: string[] @@ -92,7 +94,9 @@ export async function findFilesToUpload( directories so filter any directories out from the raw search results */ for (const searchResult of rawSearchResults) { - if (!lstatSync(searchResult).isDirectory()) { + const fileStats = await stats(searchResult) + // isDirectory() returns false for symlinks if using fs.lstat(), make sure to use fs.stat() instead + if (!fileStats.isDirectory()) { debug(`File:${searchResult} was found using the provided searchPath`) searchResults.push(searchResult) } else {