Compare commits

..

1 Commits

Author SHA1 Message Date
5dc68c18e2 Update to node16
Node 12 has an end of life on April 30, 2022.

This PR updates the default runtime to [node16](https://github.blog/changelog/2021-12-10-github-actions-github-hosted-runners-now-run-node-js-16-by-default/), rather then node12. 

This is supported on all Actions Runners v2.285.0 or later.
2022-02-07 14:06:57 -05:00
29 changed files with 16035 additions and 19142 deletions

View File

@ -1,6 +0,0 @@
// 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,10 +4,13 @@
"parserOptions": { "ecmaVersion": 9, "sourceType": "module" }, "parserOptions": { "ecmaVersion": 9, "sourceType": "module" },
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors", "plugin:import/errors",
"plugin:import/warnings", "plugin:import/warnings",
"plugin:import/typescript", "plugin:import/typescript",
"plugin:prettier/recommended" "plugin:prettier/recommended",
"prettier/@typescript-eslint"
], ],
"rules": { "rules": {
"@typescript-eslint/no-empty-function": "off" "@typescript-eslint/no-empty-function": "off"

View File

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

View File

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

View File

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

View File

@ -23,13 +23,12 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v2
- name: Setup Node 16 - name: Set Node.js 12.x
uses: actions/setup-node@v3 uses: actions/setup-node@v1
with: with:
node-version: 16.x node-version: 12.x
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
@ -37,21 +36,21 @@ jobs:
- name: Compile - name: Compile
run: npm run build run: npm run build
- name: npm test
run: npm test
- name: Lint - name: Lint
run: npm run lint run: npm run lint
- name: Format - name: Format
run: npm run format-check run: npm run format-check
- name: Test
run: npm run test
# Test end-to-end by uploading two artifacts and then downloading them # Test end-to-end by uploading two artifacts and then downloading them
- name: Create artifact files - name: Create artifact files
run: | run: |
mkdir -p path/to/dir-1 mkdir -p path/to/dir-1
mkdir -p path/to/dir-2 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 "Lorem ipsum dolor sit amet" > path/to/dir-1/file1.txt
echo "Hello world from file #2" > path/to/dir-2/file2.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 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
@ -86,9 +85,11 @@ jobs:
path/to/dir-[23]/* path/to/dir-[23]/*
!path/to/dir-3/*.txt !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 # Download Artifact #1 and verify the correctness of the content
- name: 'Download artifact #1' - name: 'Download artifact #1'
uses: actions/download-artifact@v3 uses: actions/download-artifact@v1
with: with:
name: 'Artifact-A' name: 'Artifact-A'
path: some/new/path path: some/new/path
@ -108,7 +109,7 @@ jobs:
# Download Artifact #2 and verify the correctness of the content # Download Artifact #2 and verify the correctness of the content
- name: 'Download artifact #2' - name: 'Download artifact #2'
uses: actions/download-artifact@v3 uses: actions/download-artifact@v1
with: with:
name: 'artifact' name: 'artifact'
path: some/other/path path: some/other/path
@ -126,10 +127,10 @@ jobs:
Write-Error "File contents of downloaded artifacts are incorrect" Write-Error "File contents of downloaded artifacts are incorrect"
} }
shell: pwsh shell: pwsh
# Download Artifact #3 and verify the correctness of the content # Download Artifact #3 and verify the correctness of the content
- name: 'Download artifact #3' - name: 'Download artifact #3'
uses: actions/download-artifact@v3 uses: actions/download-artifact@v1
with: with:
name: 'GZip-Artifact' name: 'GZip-Artifact'
path: gzip/artifact/path path: gzip/artifact/path
@ -149,7 +150,7 @@ jobs:
shell: pwsh shell: pwsh
- name: 'Download artifact #4' - name: 'Download artifact #4'
uses: actions/download-artifact@v3 uses: actions/download-artifact@v1
with: with:
name: 'Multi-Path-Artifact' name: 'Multi-Path-Artifact'
path: multi/artifact path: multi/artifact

View File

@ -1,20 +1,30 @@
--- ---
name: "@actions/artifact" name: "@actions/artifact"
version: 1.1.2 version: 0.6.1
type: npm type: npm
summary: Actions artifact lib summary:
homepage: https://github.com/actions/toolkit/tree/main/packages/artifact homepage:
license: mit license: mit
licenses: licenses:
- sources: LICENSE.md - sources: Auto-generated MIT license text
text: |- text: |
The MIT License (MIT) MIT License
Copyright 2019 GitHub 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:
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 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,
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. 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: [] notices: []

View File

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

View File

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

View File

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

View File

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

26
.licenses/npm/@types/tmp.dep.yml generated Normal file
View File

@ -0,0 +1,26 @@
---
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 name: glob
version: 7.2.3 version: 7.1.6
type: npm type: npm
summary: a little globber summary: a little globber
homepage: homepage: https://github.com/isaacs/node-glob#readme
license: isc license: isc
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

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

View File

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

View File

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

View File

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

View File

@ -1,20 +0,0 @@
---
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

@ -1,4 +1,4 @@
# Upload-Artifact v3 # Upload-Artifact v2
This uploads artifacts from your workflow allowing you to share data between jobs and store data once a workflow is complete. This uploads artifacts from your workflow allowing you to share data between jobs and store data once a workflow is complete.
@ -28,13 +28,13 @@ See [action.yml](action.yml)
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- run: mkdir -p path/to/artifact - run: mkdir -p path/to/artifact
- run: echo hello > path/to/artifact/world.txt - run: echo hello > path/to/artifact/world.txt
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: my-artifact name: my-artifact
path: path/to/artifact/world.txt path: path/to/artifact/world.txt
@ -43,7 +43,7 @@ steps:
### Upload an Entire Directory ### Upload an Entire Directory
```yaml ```yaml
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: my-artifact name: my-artifact
path: path/to/artifact/ # or path/to/artifact path: path/to/artifact/ # or path/to/artifact
@ -52,7 +52,7 @@ steps:
### Upload using a Wildcard Pattern ### Upload using a Wildcard Pattern
```yaml ```yaml
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: my-artifact name: my-artifact
path: path/**/[abc]rtifac?/* path: path/**/[abc]rtifac?/*
@ -61,7 +61,7 @@ steps:
### Upload using Multiple Paths and Exclusions ### Upload using Multiple Paths and Exclusions
```yaml ```yaml
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: my-artifact name: my-artifact
path: | path: |
@ -97,7 +97,7 @@ The [@actions/artifact](https://github.com/actions/toolkit/tree/main/packages/ar
If a path (or paths), result in no files being found for the artifact, the action will succeed but print out a warning. In certain scenarios it may be desirable to fail the action or suppress the warning. The `if-no-files-found` option allows you to customize the behavior of the action if no files are found: If a path (or paths), result in no files being found for the artifact, the action will succeed but print out a warning. In certain scenarios it may be desirable to fail the action or suppress the warning. The `if-no-files-found` option allows you to customize the behavior of the action if no files are found:
```yaml ```yaml
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: my-artifact name: my-artifact
path: path/to/artifact/ path: path/to/artifact/
@ -109,7 +109,7 @@ If a path (or paths), result in no files being found for the artifact, the actio
To upload artifacts only when the previous step of a job failed, use [`if: failure()`](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#job-status-check-functions): To upload artifacts only when the previous step of a job failed, use [`if: failure()`](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#job-status-check-functions):
```yaml ```yaml
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
if: failure() if: failure()
with: with:
name: my-artifact name: my-artifact
@ -121,7 +121,7 @@ To upload artifacts only when the previous step of a job failed, use [`if: failu
You can upload an artifact without specifying a name You can upload an artifact without specifying a name
```yaml ```yaml
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
path: path/to/artifact/world.txt path: path/to/artifact/world.txt
``` ```
@ -134,17 +134,17 @@ With the following example, the available artifact (named `artifact` by default
```yaml ```yaml
- run: echo hi > world.txt - run: echo hi > world.txt
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
path: world.txt path: world.txt
- run: echo howdy > extra-file.txt - run: echo howdy > extra-file.txt
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
path: extra-file.txt path: extra-file.txt
- run: echo hello > world.txt - run: echo hello > world.txt
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
path: world.txt path: world.txt
``` ```
@ -159,7 +159,7 @@ Each artifact behaves as a file share. Uploading to the same artifact multiple t
- name: Create a file - name: Create a file
run: echo ${{ matrix.node-version }} > my_file.txt run: echo ${{ matrix.node-version }} > my_file.txt
- name: Accidentally upload to the same artifact via multiple jobs - name: Accidentally upload to the same artifact via multiple jobs
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v2
with: with:
name: my-artifact name: my-artifact
path: ${{ github.workspace }} path: ${{ github.workspace }}
@ -170,7 +170,7 @@ Each artifact behaves as a file share. Uploading to the same artifact multiple t
In the above example, four jobs will upload four different files to the same artifact but there will only be one file available when `my-artifact` is downloaded. Each job overwrites what was previously uploaded. To ensure that jobs don't overwrite existing artifacts, use a different name per job: In the above example, four jobs will upload four different files to the same artifact but there will only be one file available when `my-artifact` is downloaded. Each job overwrites what was previously uploaded. To ensure that jobs don't overwrite existing artifacts, use a different name per job:
```yaml ```yaml
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v2
with: with:
name: my-artifact ${{ matrix.node-version }} name: my-artifact ${{ matrix.node-version }}
path: ${{ github.workspace }} path: ${{ github.workspace }}
@ -184,9 +184,9 @@ You can use `~` in the path input as a substitute for `$HOME`. Basic tilde expan
- run: | - run: |
mkdir -p ~/new/artifact mkdir -p ~/new/artifact
echo hello > ~/new/artifact/world.txt echo hello > ~/new/artifact/world.txt
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: Artifacts-V3 name: Artifacts-V2
path: ~/new/**/* path: ~/new/**/*
``` ```
@ -199,7 +199,7 @@ Environment variables along with context expressions can also be used for input.
- run: | - run: |
mkdir -p ${{ github.workspace }}/artifact mkdir -p ${{ github.workspace }}/artifact
echo hello > ${{ github.workspace }}/artifact/world.txt echo hello > ${{ github.workspace }}/artifact/world.txt
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: ${{ env.name }}-name name: ${{ env.name }}-name
path: ${{ github.workspace }}/artifact/**/* path: ${{ github.workspace }}/artifact/**/*
@ -213,7 +213,7 @@ For environment variables created in other steps, make sure to use the `env` exp
mkdir testing mkdir testing
echo "This is a file to upload" > testing/file.txt echo "This is a file to upload" > testing/file.txt
echo "artifactPath=testing/file.txt" >> $GITHUB_ENV echo "artifactPath=testing/file.txt" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v2
with: with:
name: artifact name: artifact
path: ${{ env.artifactPath }} # this will resolve to testing/file.txt at runtime path: ${{ env.artifactPath }} # this will resolve to testing/file.txt at runtime
@ -228,7 +228,7 @@ Artifacts are retained for 90 days by default. You can specify a shorter retenti
run: echo "I won't live long" > my_file.txt run: echo "I won't live long" > my_file.txt
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v2
with: with:
name: my-artifact name: my-artifact
path: my_file.txt path: my_file.txt
@ -237,29 +237,6 @@ 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). 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? ## 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: At the bottom of the workflow summary page, there is a dedicated section for artifacts. Here's a screenshot of something you might see:
@ -293,7 +270,7 @@ If file permissions and case sensitivity are required, you can `tar` all of your
run: tar -cvf my_files.tar /path/to/my/directory run: tar -cvf my_files.tar /path/to/my/directory
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v2
with: with:
name: my-artifact name: my-artifact
path: my_files.tar path: my_files.tar

View File

@ -61,20 +61,6 @@ const lonelyFilePath = path.join(
'lonely-file.txt' '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', () => { describe('Search', () => {
beforeAll(async () => { beforeAll(async () => {
// mock all output so that there is less noise when running tests // mock all output so that there is less noise when running tests
@ -106,13 +92,6 @@ describe('Search', () => {
await fs.mkdir(path.join(root, 'folder-h', 'folder-j', 'folder-k'), { await fs.mkdir(path.join(root, 'folder-h', 'folder-j', 'folder-k'), {
recursive: true 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(searchItem1Path, 'search item1 file')
await fs.writeFile(searchItem2Path, 'search item2 file') await fs.writeFile(searchItem2Path, 'search item2 file')
@ -131,19 +110,10 @@ describe('Search', () => {
await fs.writeFile(amazingFileInFolderHPath, 'amazing file') await fs.writeFile(amazingFileInFolderHPath, 'amazing file')
await fs.writeFile(lonelyFilePath, 'all by itself') 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: Directory structure of files that get created:
root/ root/
.hidden-folder/
folder-in-hidden-folder/
file.txt
folder-a/ folder-a/
.hidden-folder-in-folder-a/
file.txt
folder-b/ folder-b/
folder-c/ folder-c/
search-item1.txt search-item1.txt
@ -166,7 +136,6 @@ describe('Search', () => {
folder-j/ folder-j/
folder-k/ folder-k/
lonely-file.txt lonely-file.txt
.hidden-file.txt
search-item5.txt search-item5.txt
*/ */
}) })
@ -383,24 +352,4 @@ describe('Search', () => {
) )
expect(searchResult.filesToUpload.includes(lonelyFilePath)).toEqual(true) 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,11 +23,6 @@ inputs:
Minimum 1 day. Minimum 1 day.
Maximum 90 days unless changed from the repository settings page. 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: runs:
using: 'node20' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'

17607
dist/index.js vendored

File diff suppressed because it is too large Load Diff

17208
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "upload-artifact", "name": "upload-artifact",
"version": "3.0.0", "version": "2.0.1",
"description": "Upload a build artifact that can be used by subsequent workflow steps", "description": "Upload a build artifact that can be used by subsequent workflow steps",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
@ -29,25 +29,25 @@
}, },
"homepage": "https://github.com/actions/upload-artifact#readme", "homepage": "https://github.com/actions/upload-artifact#readme",
"dependencies": { "dependencies": {
"@actions/artifact": "^1.1.2", "@actions/artifact": "^0.6.1",
"@actions/core": "^1.10.0", "@actions/core": "^1.2.6",
"@actions/glob": "^0.5.0", "@actions/glob": "^0.1.0",
"@actions/io": "^1.1.2" "@actions/io": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.2.5", "@types/jest": "^25.2.1",
"@types/node": "^18.11.18", "@types/node": "^13.11.1",
"@typescript-eslint/parser": "^5.48.0", "@typescript-eslint/parser": "^2.27.0",
"@vercel/ncc": "^0.36.0", "@zeit/ncc": "^0.22.1",
"concurrently": "^7.6.0", "concurrently": "^5.1.0",
"eslint": "^8.31.0", "eslint": "^7.4.0",
"eslint-plugin-github": "^4.6.0", "eslint-plugin-github": "^4.1.1",
"eslint-plugin-jest": "^27.2.0", "eslint-plugin-jest": "^23.8.2",
"glob": "^8.0.3", "glob": "^7.1.6",
"jest": "^29.3.1", "jest": "^27.2.5",
"jest-circus": "^29.3.1", "jest-circus": "^27.2.5",
"prettier": "^2.8.1", "prettier": "^2.0.4",
"ts-jest": "^29.0.3", "ts-jest": "^27.0.6",
"typescript": "^4.9.4" "typescript": "^3.8.3"
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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