Compare commits

...

30 Commits

Author SHA1 Message Date
ff15f0306b Merge pull request #609 from actions/joshmgross/fix-include-hidden-files-input-node16
Ensure hidden files input is used
2024-09-02 12:45:38 -04:00
87b9624c21 Ensure hidden files input is used 2024-09-02 12:34:51 -04:00
9ee08a3b00 Merge pull request #604 from actions/v3/backport-exclude-hidden-files
V3 backport: Exclude hidden files by default
2024-08-29 11:44:05 -04:00
ff37344dc2 Update documentation for action 2024-08-22 14:46:08 +00:00
d99c5eca07 update readme with section 2024-08-22 14:43:51 +00:00
afc7e4a27d Exclude hidden files by default backport 2024-08-22 14:36:56 +00:00
a8a3f3ad30 Merge pull request #436 from bethanyj28/main
Bump @actions/artifact version
2023-09-06 15:03:53 -04:00
7b48769c03 update dependency cache 2023-09-06 11:46:07 -07:00
66630398df update dist/index.js 2023-09-06 11:42:11 -07:00
55e76b779d bump @actions/artifact version 2023-09-06 11:35:17 -07:00
65d862660a chore(github): remove trailing whitespaces (#313)
Signed-off-by: Luís Ferreira <contact@lsferreira.net>

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Co-authored-by: Konrad Pabjan <konradpabjan@github.com>
2023-01-06 09:46:02 -05:00
0b7f8abb15 ci(github): update action/download-artifact from v1 to v3 (#312)
Signed-off-by: Luís Ferreira <contact@lsferreira.net>

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Co-authored-by: Konrad Pabjan <konradpabjan@github.com>
2023-01-05 18:07:55 -05:00
013d2b89ba Create devcontainer for codespaces + update all dev dependencies (#375)
* Create devcontainer for codespaces

* Use node 16 for devcontainer and CI

* Fix node version incompatibility error

* Remove caching

* Add npm build to check-dist

* Remove new caching

* use npm install

* Test node 14

* Update check dist with node 16

* Use node 18.x for check-dist

* Npm install vs CI

* Update package.json scripts

* test

* Remove caching

* npm run test

* testing

* test

* test

* One more test

* Test

* test

* Update everything

* use vercel

* Test

* Update index.js

* Test

* Remove codeql warnings

* Use NPM CI vs install

* Small tweaks to existing workflows
2023-01-05 16:27:11 -05:00
055b8b3f04 Bump Actions NPM dependencies (#374) 2023-01-04 13:55:10 -05:00
7a5d4831f7 ci(github): update action/checkout from v2 to v3 (#315)
Signed-off-by: Luís Ferreira <contact@lsferreira.net>

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Co-authored-by: Konrad Pabjan <konradpabjan@github.com>
2023-01-04 13:44:29 -05:00
e0057a5b76 README: Bump actions/checkout to v3 (#352)
`Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/checkout, actions/checkout`

It's great to have non-deprecated examples.
2023-01-04 13:34:12 -05:00
7fe6c13ac8 Update to latest actions/publish-action (#363)
To avoid Actions core deprecation messages.

https://github.com/actions/publish-action/releases/tag/v0.2.1
2023-01-04 13:21:58 -05:00
83fd05a356 Bump actions-core to v1.10.0 (#356) 2022-10-21 15:17:17 -04:00
3cea537223 Merge pull request #327 from actions/robherley/artifact-1.1.0
Bump @actions/artifact to 1.1.0
2022-05-20 10:28:12 -04:00
849aa7758a nvm use 12 & npm run release 2022-05-19 21:17:44 +00:00
4d3986961d recompile with correct ncc version 2022-05-19 20:46:08 +00:00
2e0d362ec5 bump @actions/artifact to 1.1.0 2022-05-19 20:33:04 +00:00
09a5d6a283 Merge pull request #320 from actions/dependabot/npm_and_yarn/ansi-regex-4.1.1
Bump ansi-regex from 4.1.0 to 4.1.1
2022-04-25 09:59:36 -04:00
189315d910 Bump ansi-regex from 4.1.0 to 4.1.1
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-25 13:56:12 +00:00
d159c2d80b Merge pull request #297 from actions/dependabot/npm_and_yarn/ajv-6.12.6
Bump ajv from 6.11.0 to 6.12.6
2022-04-25 09:55:27 -04:00
c26a7ba4b5 Bump ajv from 6.11.0 to 6.12.6
Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.11.0 to 6.12.6.
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](https://github.com/ajv-validator/ajv/compare/v6.11.0...v6.12.6)

---
updated-dependencies:
- dependency-name: ajv
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-25 13:50:51 +00:00
6ed6c72922 Merge pull request #303 from actions/dependabot/npm_and_yarn/yargs-parser-13.1.2
Bump yargs-parser from 13.1.1 to 13.1.2
2022-04-25 09:50:11 -04:00
2aeee267b2 Bump yargs-parser from 13.1.1 to 13.1.2
Bumps [yargs-parser](https://github.com/yargs/yargs-parser) from 13.1.1 to 13.1.2.
- [Release notes](https://github.com/yargs/yargs-parser/releases)
- [Changelog](https://github.com/yargs/yargs-parser/blob/main/docs/CHANGELOG-full.md)
- [Commits](https://github.com/yargs/yargs-parser/commits)

---
updated-dependencies:
- dependency-name: yargs-parser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-25 13:47:10 +00:00
0e2226cf92 Merge pull request #311 from actions/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-04-25 09:46:22 -04:00
f29a5d04a6 Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 14:50:39 +00:00
29 changed files with 16829 additions and 23612 deletions

View File

@ -0,0 +1,6 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "@actions/upload-artifact",
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-16"
}

View File

@ -4,13 +4,10 @@
"parserOptions": { "ecmaVersion": 9, "sourceType": "module" },
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/no-empty-function": "off"

View File

@ -20,19 +20,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set Node.js 12.x
uses: actions/setup-node@v1
- name: Setup Node 16
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 16.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Move the committed index.js file
run: mv dist/index.js /tmp
- name: Rebuild with tsc
run: npm run build
- name: Rebuild the index.js file
run: npm run release
@ -41,7 +45,7 @@ jobs:
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: index.js

View File

@ -17,11 +17,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java
@ -29,7 +29,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@ -43,4 +43,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2

View File

@ -22,7 +22,7 @@ jobs:
steps:
- name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag
uses: actions/publish-action@v0.1.0
uses: actions/publish-action@v0.2.1
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@ -23,12 +23,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set Node.js 12.x
uses: actions/setup-node@v1
- name: Setup Node 16
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 16.x
cache: 'npm'
- name: Install dependencies
run: npm ci
@ -36,21 +37,21 @@ jobs:
- name: Compile
run: npm run build
- name: npm test
run: npm test
- name: Lint
run: npm run lint
- name: Format
run: npm run format-check
- name: Test
run: npm run test
# Test end-to-end by uploading two artifacts and then downloading them
- name: Create artifact files
run: |
mkdir -p path/to/dir-1
mkdir -p path/to/dir-2
mkdir -p path/to/dir-3
mkdir -p path/to/dir-3
echo "Lorem ipsum dolor sit amet" > path/to/dir-1/file1.txt
echo "Hello world from file #2" > path/to/dir-2/file2.txt
echo "This is a going to be a test for a large enough file that should get compressed with GZip. The @actions/artifact package uses GZip to upload files. This text should have a compression ratio greater than 100% so it should get uploaded using GZip" > path/to/dir-3/gzip.txt
@ -85,11 +86,9 @@ jobs:
path/to/dir-[23]/*
!path/to/dir-3/*.txt
# Verify artifacts. Switch to download-artifact@v2 once it's out of preview
# Download Artifact #1 and verify the correctness of the content
- name: 'Download artifact #1'
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: 'Artifact-A'
path: some/new/path
@ -109,7 +108,7 @@ jobs:
# Download Artifact #2 and verify the correctness of the content
- name: 'Download artifact #2'
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: 'artifact'
path: some/other/path
@ -127,10 +126,10 @@ jobs:
Write-Error "File contents of downloaded artifacts are incorrect"
}
shell: pwsh
# Download Artifact #3 and verify the correctness of the content
- name: 'Download artifact #3'
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: 'GZip-Artifact'
path: gzip/artifact/path
@ -150,7 +149,7 @@ jobs:
shell: pwsh
- name: 'Download artifact #4'
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: 'Multi-Path-Artifact'
path: multi/artifact

View File

@ -1,30 +1,20 @@
---
name: "@actions/artifact"
version: 1.0.0
version: 1.1.2
type: npm
summary:
homepage:
summary: Actions artifact lib
homepage: https://github.com/actions/toolkit/tree/main/packages/artifact
license: mit
licenses:
- sources: Auto-generated MIT license text
text: |
MIT License
- sources: LICENSE.md
text: |-
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Copyright 2019 GitHub
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View File

@ -1,6 +1,6 @@
---
name: "@actions/core"
version: 1.2.6
version: 1.10.0
type: npm
summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core

View File

@ -1,6 +1,6 @@
---
name: "@actions/glob"
version: 0.1.0
version: 0.3.0
type: npm
summary: Actions glob lib
homepage: https://github.com/actions/toolkit/tree/master/packages/glob

View File

@ -1,9 +1,9 @@
---
name: "@actions/http-client"
version: 1.0.11
version: 2.0.1
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/http-client#readme
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
license: mit
licenses:
- sources: LICENSE

View File

@ -1,6 +1,6 @@
---
name: "@actions/io"
version: 1.0.2
version: 1.1.2
type: npm
summary: Actions io lib
homepage: https://github.com/actions/toolkit/tree/master/packages/io

View File

@ -1,26 +0,0 @@
---
name: "@types/tmp"
version: 0.1.0
type: npm
summary: TypeScript definitions for tmp
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped#readme
license: mit
licenses:
- sources: LICENSE
text: " MIT License\r\n\r\n Copyright (c) Microsoft Corporation. All rights
reserved.\r\n\r\n Permission is hereby granted, free of charge, to any person
obtaining a copy\r\n of this software and associated documentation files (the
\"Software\"), to deal\r\n in the Software without restriction, including without
limitation the rights\r\n to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell\r\n copies of the Software, and to permit persons to
whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n\r\n
\ The above copyright notice and this permission notice shall be included in
all\r\n copies or substantial portions of the Software.\r\n\r\n THE SOFTWARE
IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n
\ SOFTWARE\r\n"
notices: []

View File

@ -1,9 +1,9 @@
---
name: glob
version: 7.1.6
version: 7.2.3
type: npm
summary: a little globber
homepage: https://github.com/isaacs/node-glob#readme
homepage:
license: isc
licenses:
- sources: LICENSE

View File

@ -1,9 +1,9 @@
---
name: minimatch
version: 3.0.4
version: 3.1.2
type: npm
summary: a glob matcher in javascript
homepage: https://github.com/isaacs/minimatch#readme
homepage:
license: isc
licenses:
- sources: LICENSE

View File

@ -1,9 +1,9 @@
---
name: rimraf
version: 2.6.3
version: 3.0.2
type: npm
summary: A deep deletion module for node (like `rm -rf`)
homepage: https://github.com/isaacs/rimraf#readme
homepage:
license: isc
licenses:
- sources: LICENSE

View File

@ -1,9 +1,9 @@
---
name: tmp-promise
version: 2.1.1
version: 3.0.3
type: npm
summary: The tmp package with promises support and disposers.
homepage: https://github.com/benjamingr/tmp-promise#readme
homepage:
license: mit
licenses:
- sources: Auto-generated MIT license text

View File

@ -1,6 +1,6 @@
---
name: tmp
version: 0.1.0
version: 0.2.1
type: npm
summary: Temporary file and directory creator
homepage: http://github.com/raszi/node-tmp

20
.licenses/npm/uuid.dep.yml generated Normal file
View File

@ -0,0 +1,20 @@
---
name: uuid
version: 8.3.2
type: npm
summary: RFC4122 (v1, v4, and v5) UUIDs
homepage:
license: mit
licenses:
- sources: LICENSE.md
text: |
The MIT License (MIT)
Copyright (c) 2010-2020 Robert Kieffer and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View File

@ -28,7 +28,7 @@ See [action.yml](action.yml)
```yaml
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: mkdir -p path/to/artifact
@ -237,6 +237,29 @@ Artifacts are retained for 90 days by default. You can specify a shorter retenti
The retention period must be between 1 and 90 inclusive. For more information see [artifact and log retention policies](https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration#artifact-and-log-retention-policy).
### Hidden Files
By default, hidden files are ignored by this action to avoid unintentionally uploading sensitive information.
In versions of this action before v3.2.0, these hidden files were included by default.
If you need to upload hidden files, you can use the `include-hidden-files` input.
```yaml
jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Create a Hidden File
run: echo "hello from a hidden file" > .hidden-file.txt
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: .hidden-file.txt
include-hidden-files: true
```
## Where does the upload go?
At the bottom of the workflow summary page, there is a dedicated section for artifacts. Here's a screenshot of something you might see:

View File

@ -61,6 +61,20 @@ const lonelyFilePath = path.join(
'lonely-file.txt'
)
const hiddenFile = path.join(root, '.hidden-file.txt')
const fileInHiddenFolderPath = path.join(
root,
'.hidden-folder',
'folder-in-hidden-folder',
'file.txt'
)
const fileInHiddenFolderInFolderA = path.join(
root,
'folder-a',
'.hidden-folder-in-folder-a',
'file.txt'
)
describe('Search', () => {
beforeAll(async () => {
// mock all output so that there is less noise when running tests
@ -92,6 +106,13 @@ describe('Search', () => {
await fs.mkdir(path.join(root, 'folder-h', 'folder-j', 'folder-k'), {
recursive: true
})
await fs.mkdir(
path.join(root, '.hidden-folder', 'folder-in-hidden-folder'),
{recursive: true}
)
await fs.mkdir(path.join(root, 'folder-a', '.hidden-folder-in-folder-a'), {
recursive: true
})
await fs.writeFile(searchItem1Path, 'search item1 file')
await fs.writeFile(searchItem2Path, 'search item2 file')
@ -110,10 +131,19 @@ describe('Search', () => {
await fs.writeFile(amazingFileInFolderHPath, 'amazing file')
await fs.writeFile(lonelyFilePath, 'all by itself')
await fs.writeFile(hiddenFile, 'hidden file')
await fs.writeFile(fileInHiddenFolderPath, 'file in hidden directory')
await fs.writeFile(fileInHiddenFolderInFolderA, 'file in hidden directory')
/*
Directory structure of files that get created:
root/
.hidden-folder/
folder-in-hidden-folder/
file.txt
folder-a/
.hidden-folder-in-folder-a/
file.txt
folder-b/
folder-c/
search-item1.txt
@ -136,6 +166,7 @@ describe('Search', () => {
folder-j/
folder-k/
lonely-file.txt
.hidden-file.txt
search-item5.txt
*/
})
@ -352,4 +383,24 @@ describe('Search', () => {
)
expect(searchResult.filesToUpload.includes(lonelyFilePath)).toEqual(true)
})
it('Hidden files ignored by default', async () => {
const searchPath = path.join(root, '**/*')
const searchResult = await findFilesToUpload(searchPath)
expect(searchResult.filesToUpload).not.toContain(hiddenFile)
expect(searchResult.filesToUpload).not.toContain(fileInHiddenFolderPath)
expect(searchResult.filesToUpload).not.toContain(
fileInHiddenFolderInFolderA
)
})
it('Hidden files included', async () => {
const searchPath = path.join(root, '**/*')
const searchResult = await findFilesToUpload(searchPath, true)
expect(searchResult.filesToUpload).toContain(hiddenFile)
expect(searchResult.filesToUpload).toContain(fileInHiddenFolderPath)
expect(searchResult.filesToUpload).toContain(fileInHiddenFolderInFolderA)
})
})

View File

@ -23,6 +23,11 @@ inputs:
Minimum 1 day.
Maximum 90 days unless changed from the repository settings page.
include-hidden-files:
description: >
If true, hidden files will be included in the uploaded artifact.
If false, hidden files will be excluded from the uploaded artifact.
default: 'false'
runs:
using: 'node16'
main: 'dist/index.js'

17628
dist/index.js vendored

File diff suppressed because it is too large Load Diff

22493
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,25 +29,25 @@
},
"homepage": "https://github.com/actions/upload-artifact#readme",
"dependencies": {
"@actions/artifact": "^1.0.0",
"@actions/core": "^1.2.6",
"@actions/glob": "^0.1.0",
"@actions/io": "^1.0.2"
"@actions/artifact": "^1.1.2",
"@actions/core": "^1.10.0",
"@actions/glob": "^0.5.0",
"@actions/io": "^1.1.2"
},
"devDependencies": {
"@types/jest": "^25.2.1",
"@types/node": "^13.11.1",
"@typescript-eslint/parser": "^2.27.0",
"@zeit/ncc": "^0.22.1",
"concurrently": "^5.1.0",
"eslint": "^7.4.0",
"eslint-plugin-github": "^4.1.1",
"eslint-plugin-jest": "^23.8.2",
"glob": "^7.1.6",
"jest": "^27.2.5",
"jest-circus": "^27.2.5",
"prettier": "^2.0.4",
"ts-jest": "^27.0.6",
"typescript": "^3.8.3"
"@types/jest": "^29.2.5",
"@types/node": "^18.11.18",
"@typescript-eslint/parser": "^5.48.0",
"@vercel/ncc": "^0.36.0",
"concurrently": "^7.6.0",
"eslint": "^8.31.0",
"eslint-plugin-github": "^4.6.0",
"eslint-plugin-jest": "^27.2.0",
"glob": "^8.0.3",
"jest": "^29.3.1",
"jest-circus": "^29.3.1",
"prettier": "^2.8.1",
"ts-jest": "^29.0.3",
"typescript": "^4.9.4"
}
}

View File

@ -1,8 +1,10 @@
/* eslint-disable no-unused-vars */
export enum Inputs {
Name = 'name',
Path = 'path',
IfNoFilesFound = 'if-no-files-found',
RetentionDays = 'retention-days'
RetentionDays = 'retention-days',
IncludeHiddenFiles = 'include-hidden-files'
}
export enum NoFileOptions {

View File

@ -11,6 +11,7 @@ export function getInputs(): UploadInputs {
const ifNoFilesFound = core.getInput(Inputs.IfNoFilesFound)
const noFileBehavior: NoFileOptions = NoFileOptions[ifNoFilesFound]
const includeHiddenFiles = core.getBooleanInput(Inputs.IncludeHiddenFiles)
if (!noFileBehavior) {
core.setFailed(
@ -25,7 +26,8 @@ export function getInputs(): UploadInputs {
const inputs = {
artifactName: name,
searchPath: path,
ifNoFilesFound: noFileBehavior
ifNoFilesFound: noFileBehavior,
includeHiddenFiles
} as UploadInputs
const retentionDaysStr = core.getInput(Inputs.RetentionDays)

View File

@ -11,11 +11,12 @@ export interface SearchResult {
rootDirectory: string
}
function getDefaultGlobOptions(): glob.GlobOptions {
function getDefaultGlobOptions(includeHiddenFiles: boolean): glob.GlobOptions {
return {
followSymbolicLinks: true,
implicitDescendants: true,
omitBrokenSymbolicLinks: true
omitBrokenSymbolicLinks: true,
excludeHiddenFiles: !includeHiddenFiles
}
}
@ -80,12 +81,12 @@ function getMultiPathLCA(searchPaths: string[]): string {
export async function findFilesToUpload(
searchPath: string,
globOptions?: glob.GlobOptions
includeHiddenFiles?: boolean
): Promise<SearchResult> {
const searchResults: string[] = []
const globber = await glob.create(
searchPath,
globOptions || getDefaultGlobOptions()
getDefaultGlobOptions(includeHiddenFiles || false)
)
const rawSearchResults: string[] = await globber.glob()

View File

@ -7,7 +7,10 @@ import {NoFileOptions} from './constants'
async function run(): Promise<void> {
try {
const inputs = getInputs()
const searchResult = await findFilesToUpload(inputs.searchPath)
const searchResult = await findFilesToUpload(
inputs.searchPath,
inputs.includeHiddenFiles
)
if (searchResult.filesToUpload.length === 0) {
// No files were found, different use cases warrant different types of behavior if nothing is found
switch (inputs.ifNoFilesFound) {
@ -68,8 +71,8 @@ async function run(): Promise<void> {
)
}
}
} catch (err) {
core.setFailed(err.message)
} catch (error) {
core.setFailed((error as Error).message)
}
}

View File

@ -20,4 +20,9 @@ export interface UploadInputs {
* Duration after which artifact will expire in days
*/
retentionDays: number
/**
* Whether or not to include hidden files in the artifact
*/
includeHiddenFiles: boolean
}