Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6e29846f2 | ||
|
|
7c15bf6f40 | ||
|
|
bc713ab90d | ||
|
|
a9d266bb7c | ||
|
|
cf3dd065b8 | ||
|
|
6ec51745ad | ||
|
|
0f91c9c203 | ||
|
|
e18b2d8a33 | ||
|
|
4fd425926c | ||
|
|
83dffb7746 | ||
|
|
1d1d5456e3 | ||
|
|
9e06993ffc | ||
|
|
3630ea6eed | ||
|
|
c2d3089f83 | ||
|
|
652109d32c | ||
|
|
f2aa430c9d | ||
|
|
d2b7d85e7c | ||
|
|
409d616a6e | ||
|
|
e3c2a88bbf | ||
|
|
ea21da6993 | ||
|
|
c6005c2a3c | ||
|
|
1589a5c066 | ||
|
|
d3801d332c | ||
|
|
5804607845 | ||
|
|
c26f803662 | ||
|
|
6c1f9eaae8 | ||
|
|
412417d0b0 | ||
|
|
71a6fceb8c | ||
|
|
34577b269e | ||
|
|
56146a6713 | ||
|
|
74f24b41d1 |
@@ -22,10 +22,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
- name: Set Node.js 16.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
- name: Set Node.js 16.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
- name: Set Node.js 16.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: setup repo
|
- name: setup repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: verify package exists
|
- name: verify package exists
|
||||||
run: ls packages/${{ github.event.inputs.package }}
|
run: ls packages/${{ github.event.inputs.package }}
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
- name: Set Node.js 16.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
working-directory: packages/${{ github.event.inputs.package }}
|
working-directory: packages/${{ github.event.inputs.package }}
|
||||||
|
|
||||||
- name: upload artifact
|
- name: upload artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.inputs.package }}
|
name: ${{ github.event.inputs.package }}
|
||||||
path: packages/${{ github.event.inputs.package }}/*.tgz
|
path: packages/${{ github.event.inputs.package }}/*.tgz
|
||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: download artifact
|
- name: download artifact
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.inputs.package }}
|
name: ${{ github.event.inputs.package }}
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
- name: Set Node.js 16.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
if: ${{ github.repository_owner == 'actions' }}
|
if: ${{ github.repository_owner == 'actions' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Update Octokit
|
- name: Update Octokit
|
||||||
working-directory: packages/github
|
working-directory: packages/github
|
||||||
run: |
|
run: |
|
||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
- name: Create PR
|
- name: Create PR
|
||||||
if: ${{steps.status.outputs.createPR}}
|
if: ${{steps.status.outputs.createPR}}
|
||||||
uses: actions/github-script@v2
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
os: [ubuntu-16.04, windows-2019]
|
os: [ubuntu-16.04, windows-2019]
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
actions:
|
actions:
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
version: ${{matrix.node}}
|
version: ${{matrix.node}}
|
||||||
- run: |
|
- run: |
|
||||||
|
|||||||
@@ -100,9 +100,12 @@ There are several commands to emit different levels of log output:
|
|||||||
| log level | example usage |
|
| log level | example usage |
|
||||||
|---|---|
|
|---|---|
|
||||||
| [debug](action-debugging.md) | `echo "::debug::My debug message"` |
|
| [debug](action-debugging.md) | `echo "::debug::My debug message"` |
|
||||||
|
| notice | `echo "::notice::My notice message"` |
|
||||||
| warning | `echo "::warning::My warning message"` |
|
| warning | `echo "::warning::My warning message"` |
|
||||||
| error | `echo "::error::My error message"` |
|
| error | `echo "::error::My error message"` |
|
||||||
|
|
||||||
|
Additional syntax options are described at [the workflow command documentation](https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-debug-message).
|
||||||
|
|
||||||
### Command Echoing
|
### Command Echoing
|
||||||
|
|
||||||
By default, the echoing of commands to stdout only occurs if [Step Debugging is enabled](./action-debugging.md#How-to-Access-Step-Debug-Logs)
|
By default, the echoing of commands to stdout only occurs if [Step Debugging is enabled](./action-debugging.md#How-to-Access-Step-Debug-Logs)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ e.g. To use https://github.com/actions/setup-node, users will author:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
using: actions/setup-node@v1
|
using: actions/setup-node@v3
|
||||||
```
|
```
|
||||||
|
|
||||||
# Define Metadata
|
# Define Metadata
|
||||||
|
|||||||
Generated
+6
-6
@@ -8954,9 +8954,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/http-cache-semantics": {
|
"node_modules/http-cache-semantics": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
|
||||||
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==",
|
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/http-proxy-agent": {
|
"node_modules/http-proxy-agent": {
|
||||||
@@ -23868,9 +23868,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"http-cache-semantics": {
|
"http-cache-semantics": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
|
||||||
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==",
|
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"http-proxy-agent": {
|
"http-proxy-agent": {
|
||||||
|
|||||||
@@ -6,13 +6,28 @@ import {promises as fs} from 'fs'
|
|||||||
import {createGZipFileOnDisk} from '../src/internal/upload-gzip'
|
import {createGZipFileOnDisk} from '../src/internal/upload-gzip'
|
||||||
|
|
||||||
const root = path.join(__dirname, '_temp', 'upload-gzip')
|
const root = path.join(__dirname, '_temp', 'upload-gzip')
|
||||||
const tempGzipFilePath = path.join(root, 'file1.gzip')
|
const tempGzFilePath = path.join(root, 'file.gz')
|
||||||
const tempZipFilePath = path.join(root, 'file2.zip')
|
const tempGzipFilePath = path.join(root, 'file.gzip')
|
||||||
const tempTarlzFilePath = path.join(root, 'file3.tar.lz')
|
const tempTgzFilePath = path.join(root, 'file.tgz')
|
||||||
const tempGzFilePath = path.join(root, 'file4.tar.gz')
|
const tempTazFilePath = path.join(root, 'file.taz')
|
||||||
const tempBz2FilePath = path.join(root, 'file5.tar.bz2')
|
const tempZFilePath = path.join(root, 'file.Z')
|
||||||
const temp7zFilePath = path.join(root, 'file6.7z')
|
const tempTaZFilePath = path.join(root, 'file.taZ')
|
||||||
const tempNormalFilePath = path.join(root, 'file6.txt')
|
const tempBz2FilePath = path.join(root, 'file.bz2')
|
||||||
|
const tempTbzFilePath = path.join(root, 'file.tbz')
|
||||||
|
const tempTbz2FilePath = path.join(root, 'file.tbz2')
|
||||||
|
const tempTz2FilePath = path.join(root, 'file.tz2')
|
||||||
|
const tempLzFilePath = path.join(root, 'file.lz')
|
||||||
|
const tempLzmaFilePath = path.join(root, 'file.lzma')
|
||||||
|
const tempTlzFilePath = path.join(root, 'file.tlz')
|
||||||
|
const tempLzoFilePath = path.join(root, 'file.lzo')
|
||||||
|
const tempXzFilePath = path.join(root, 'file.xz')
|
||||||
|
const tempTxzFilePath = path.join(root, 'file.txz')
|
||||||
|
const tempZstFilePath = path.join(root, 'file.zst')
|
||||||
|
const tempZstdFilePath = path.join(root, 'file.zstd')
|
||||||
|
const tempTzstFilePath = path.join(root, 'file.tzst')
|
||||||
|
const tempZipFilePath = path.join(root, 'file.zip')
|
||||||
|
const temp7zFilePath = path.join(root, 'file.7z')
|
||||||
|
const tempNormalFilePath = path.join(root, 'file.txt')
|
||||||
|
|
||||||
jest.mock('../src/internal/config-variables')
|
jest.mock('../src/internal/config-variables')
|
||||||
|
|
||||||
@@ -27,11 +42,26 @@ beforeAll(async () => {
|
|||||||
// clear temp directory and create files that will be "uploaded"
|
// clear temp directory and create files that will be "uploaded"
|
||||||
await io.rmRF(root)
|
await io.rmRF(root)
|
||||||
await fs.mkdir(path.join(root))
|
await fs.mkdir(path.join(root))
|
||||||
|
await fs.writeFile(tempGzFilePath, 'a file with a .gz file extension')
|
||||||
await fs.writeFile(tempGzipFilePath, 'a file with a .gzip file extension')
|
await fs.writeFile(tempGzipFilePath, 'a file with a .gzip file extension')
|
||||||
await fs.writeFile(tempZipFilePath, 'a file with a .zip file extension')
|
await fs.writeFile(tempTgzFilePath, 'a file with a .tgz file extension')
|
||||||
await fs.writeFile(tempTarlzFilePath, 'a file with a tar.lz file extension')
|
await fs.writeFile(tempTazFilePath, 'a file with a .taz file extension')
|
||||||
await fs.writeFile(tempGzFilePath, 'a file with a gz file file extension')
|
await fs.writeFile(tempZFilePath, 'a file with a .Z file extension')
|
||||||
|
await fs.writeFile(tempTaZFilePath, 'a file with a .taZ file extension')
|
||||||
await fs.writeFile(tempBz2FilePath, 'a file with a .bz2 file extension')
|
await fs.writeFile(tempBz2FilePath, 'a file with a .bz2 file extension')
|
||||||
|
await fs.writeFile(tempTbzFilePath, 'a file with a .tbz file extension')
|
||||||
|
await fs.writeFile(tempTbz2FilePath, 'a file with a .tbz2 file extension')
|
||||||
|
await fs.writeFile(tempTz2FilePath, 'a file with a .tz2 file extension')
|
||||||
|
await fs.writeFile(tempLzFilePath, 'a file with a .lz file extension')
|
||||||
|
await fs.writeFile(tempLzmaFilePath, 'a file with a .lzma file extension')
|
||||||
|
await fs.writeFile(tempTlzFilePath, 'a file with a .tlz file extension')
|
||||||
|
await fs.writeFile(tempLzoFilePath, 'a file with a .lzo file extension')
|
||||||
|
await fs.writeFile(tempXzFilePath, 'a file with a .xz file extension')
|
||||||
|
await fs.writeFile(tempTxzFilePath, 'a file with a .txz file extension')
|
||||||
|
await fs.writeFile(tempZstFilePath, 'a file with a .zst file extension')
|
||||||
|
await fs.writeFile(tempZstdFilePath, 'a file with a .zstd file extension')
|
||||||
|
await fs.writeFile(tempTzstFilePath, 'a file with a .tzst file extension')
|
||||||
|
await fs.writeFile(tempZipFilePath, 'a file with a .zip file extension')
|
||||||
await fs.writeFile(temp7zFilePath, 'a file with a .7z file extension')
|
await fs.writeFile(temp7zFilePath, 'a file with a .7z file extension')
|
||||||
await fs.writeFile(tempNormalFilePath, 'a file with a .txt file extension')
|
await fs.writeFile(tempNormalFilePath, 'a file with a .txt file extension')
|
||||||
})
|
})
|
||||||
@@ -40,21 +70,66 @@ test('Number.MAX_SAFE_INTEGER is returned when an existing compressed file is us
|
|||||||
// create temporary file
|
// create temporary file
|
||||||
const tempFile = await tmp.file()
|
const tempFile = await tmp.file()
|
||||||
|
|
||||||
expect(await createGZipFileOnDisk(tempGzipFilePath, tempFile.path)).toEqual(
|
|
||||||
Number.MAX_SAFE_INTEGER
|
|
||||||
)
|
|
||||||
expect(await createGZipFileOnDisk(tempZipFilePath, tempFile.path)).toEqual(
|
|
||||||
Number.MAX_SAFE_INTEGER
|
|
||||||
)
|
|
||||||
expect(await createGZipFileOnDisk(tempTarlzFilePath, tempFile.path)).toEqual(
|
|
||||||
Number.MAX_SAFE_INTEGER
|
|
||||||
)
|
|
||||||
expect(await createGZipFileOnDisk(tempGzFilePath, tempFile.path)).toEqual(
|
expect(await createGZipFileOnDisk(tempGzFilePath, tempFile.path)).toEqual(
|
||||||
Number.MAX_SAFE_INTEGER
|
Number.MAX_SAFE_INTEGER
|
||||||
)
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempGzipFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempTgzFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempTazFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempZFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempTaZFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
expect(await createGZipFileOnDisk(tempBz2FilePath, tempFile.path)).toEqual(
|
expect(await createGZipFileOnDisk(tempBz2FilePath, tempFile.path)).toEqual(
|
||||||
Number.MAX_SAFE_INTEGER
|
Number.MAX_SAFE_INTEGER
|
||||||
)
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempTbzFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempTbz2FilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempTz2FilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempLzFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempLzmaFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempTlzFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempLzoFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempXzFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempTxzFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempZstFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempZstdFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempTzstFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
|
expect(await createGZipFileOnDisk(tempZipFilePath, tempFile.path)).toEqual(
|
||||||
|
Number.MAX_SAFE_INTEGER
|
||||||
|
)
|
||||||
expect(await createGZipFileOnDisk(temp7zFilePath, tempFile.path)).toEqual(
|
expect(await createGZipFileOnDisk(temp7zFilePath, tempFile.path)).toEqual(
|
||||||
Number.MAX_SAFE_INTEGER
|
Number.MAX_SAFE_INTEGER
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ Note: The size of downloaded zips can differ significantly from the reported siz
|
|||||||
await createDirectoriesForArtifact(
|
await createDirectoriesForArtifact(
|
||||||
downloadSpecification.directoryStructure
|
downloadSpecification.directoryStructure
|
||||||
)
|
)
|
||||||
core.info('Directory structure has been setup for the artifact')
|
core.info('Directory structure has been set up for the artifact')
|
||||||
await createEmptyFilesForArtifact(
|
await createEmptyFilesForArtifact(
|
||||||
downloadSpecification.emptyFilesToCreate
|
downloadSpecification.emptyFilesToCreate
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ export class DownloadHttpClient {
|
|||||||
const gunzip = zlib.createGunzip()
|
const gunzip = zlib.createGunzip()
|
||||||
response.message
|
response.message
|
||||||
.on('error', error => {
|
.on('error', error => {
|
||||||
core.error(
|
core.info(
|
||||||
`An error occurred while attempting to read the response stream`
|
`An error occurred while attempting to read the response stream`
|
||||||
)
|
)
|
||||||
gunzip.close()
|
gunzip.close()
|
||||||
@@ -320,7 +320,7 @@ export class DownloadHttpClient {
|
|||||||
})
|
})
|
||||||
.pipe(gunzip)
|
.pipe(gunzip)
|
||||||
.on('error', error => {
|
.on('error', error => {
|
||||||
core.error(
|
core.info(
|
||||||
`An error occurred while attempting to decompress the response stream`
|
`An error occurred while attempting to decompress the response stream`
|
||||||
)
|
)
|
||||||
destinationStream.close()
|
destinationStream.close()
|
||||||
@@ -331,7 +331,7 @@ export class DownloadHttpClient {
|
|||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
.on('error', error => {
|
.on('error', error => {
|
||||||
core.error(
|
core.info(
|
||||||
`An error occurred while writing a downloaded file to ${destinationStream.path}`
|
`An error occurred while writing a downloaded file to ${destinationStream.path}`
|
||||||
)
|
)
|
||||||
reject(error)
|
reject(error)
|
||||||
@@ -339,7 +339,7 @@ export class DownloadHttpClient {
|
|||||||
} else {
|
} else {
|
||||||
response.message
|
response.message
|
||||||
.on('error', error => {
|
.on('error', error => {
|
||||||
core.error(
|
core.info(
|
||||||
`An error occurred while attempting to read the response stream`
|
`An error occurred while attempting to read the response stream`
|
||||||
)
|
)
|
||||||
destinationStream.close()
|
destinationStream.close()
|
||||||
@@ -350,7 +350,7 @@ export class DownloadHttpClient {
|
|||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
.on('error', error => {
|
.on('error', error => {
|
||||||
core.error(
|
core.info(
|
||||||
`An error occurred while writing a downloaded file to ${destinationStream.path}`
|
`An error occurred while writing a downloaded file to ${destinationStream.path}`
|
||||||
)
|
)
|
||||||
reject(error)
|
reject(error)
|
||||||
|
|||||||
@@ -9,15 +9,27 @@ const stat = promisify(fs.stat)
|
|||||||
* If any of these types of files are encountered then on-disk gzip creation will be skipped and the original file will be uploaded as-is
|
* If any of these types of files are encountered then on-disk gzip creation will be skipped and the original file will be uploaded as-is
|
||||||
*/
|
*/
|
||||||
const gzipExemptFileExtensions = [
|
const gzipExemptFileExtensions = [
|
||||||
'.gzip',
|
'.gz', // GZIP
|
||||||
'.zip',
|
'.gzip', // GZIP
|
||||||
'.tar.lz',
|
'.tgz', // GZIP
|
||||||
'.tar.gz',
|
'.taz', // GZIP
|
||||||
'.tar.bz2',
|
'.Z', // COMPRESS
|
||||||
'.tar.zst',
|
'.taZ', // COMPRESS
|
||||||
'.tar.zstd',
|
'.bz2', // BZIP2
|
||||||
'.tzst',
|
'.tbz', // BZIP2
|
||||||
'.7z'
|
'.tbz2', // BZIP2
|
||||||
|
'.tz2', // BZIP2
|
||||||
|
'.lz', // LZIP
|
||||||
|
'.lzma', // LZMA
|
||||||
|
'.tlz', // LZMA
|
||||||
|
'.lzo', // LZOP
|
||||||
|
'.xz', // XZ
|
||||||
|
'.txz', // XZ
|
||||||
|
'.zst', // ZSTD
|
||||||
|
'.zstd', // ZSTD
|
||||||
|
'.tzst', // ZSTD
|
||||||
|
'.zip', // ZIP
|
||||||
|
'.7z' // 7ZIP
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Vendored
+6
@@ -112,3 +112,9 @@
|
|||||||
|
|
||||||
### 3.1.2
|
### 3.1.2
|
||||||
- Fix issue with symlink restoration on windows.
|
- Fix issue with symlink restoration on windows.
|
||||||
|
|
||||||
|
### 3.1.3
|
||||||
|
- Fix to prevent from setting MYSYS environement variable globally [#1329](https://github.com/actions/toolkit/pull/1329).
|
||||||
|
|
||||||
|
### 3.1.4
|
||||||
|
- Fix zstd not being used due to `zstd --version` output change in zstd 1.5.4 release. See [#1353](https://github.com/actions/toolkit/pull/1353).
|
||||||
Vendored
+50
-17
@@ -1,5 +1,4 @@
|
|||||||
import * as exec from '@actions/exec'
|
import * as exec from '@actions/exec'
|
||||||
import {exportVariable} from '@actions/core'
|
|
||||||
import * as io from '@actions/io'
|
import * as io from '@actions/io'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import {
|
import {
|
||||||
@@ -15,8 +14,6 @@ import * as utils from '../src/internal/cacheUtils'
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
import fs = require('fs')
|
import fs = require('fs')
|
||||||
|
|
||||||
exportVariable('MSYS', 'winsymlinks:nativestrict')
|
|
||||||
|
|
||||||
jest.mock('@actions/exec')
|
jest.mock('@actions/exec')
|
||||||
jest.mock('@actions/io')
|
jest.mock('@actions/io')
|
||||||
|
|
||||||
@@ -25,6 +22,8 @@ const IS_MAC = process.platform === 'darwin'
|
|||||||
|
|
||||||
const defaultTarPath = IS_MAC ? 'gtar' : 'tar'
|
const defaultTarPath = IS_MAC ? 'gtar' : 'tar'
|
||||||
|
|
||||||
|
const defaultEnv = {MSYS: 'winsymlinks:nativestrict'}
|
||||||
|
|
||||||
function getTempDir(): string {
|
function getTempDir(): string {
|
||||||
return path.join(__dirname, '_temp', 'tar')
|
return path.join(__dirname, '_temp', 'tar')
|
||||||
}
|
}
|
||||||
@@ -78,7 +77,10 @@ test('zstd extract tar', async () => {
|
|||||||
])
|
])
|
||||||
.join(' '),
|
.join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -107,7 +109,10 @@ test('zstd extract tar with windows BSDtar', async () => {
|
|||||||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
||||||
].join(' '),
|
].join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(execMock).toHaveBeenNthCalledWith(
|
expect(execMock).toHaveBeenNthCalledWith(
|
||||||
@@ -121,7 +126,10 @@ test('zstd extract tar with windows BSDtar', async () => {
|
|||||||
workspace?.replace(/\\/g, '/')
|
workspace?.replace(/\\/g, '/')
|
||||||
].join(' '),
|
].join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -153,7 +161,10 @@ test('gzip extract tar', async () => {
|
|||||||
.concat(['-z'])
|
.concat(['-z'])
|
||||||
.join(' '),
|
.join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -182,7 +193,10 @@ test('gzip extract GNU tar on windows with GNUtar in path', async () => {
|
|||||||
'-z'
|
'-z'
|
||||||
].join(' '),
|
].join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -224,7 +238,8 @@ test('zstd create tar', async () => {
|
|||||||
.join(' '),
|
.join(' '),
|
||||||
undefined, // args
|
undefined, // args
|
||||||
{
|
{
|
||||||
cwd: archiveFolder
|
cwd: archiveFolder,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -269,7 +284,8 @@ test('zstd create tar with windows BSDtar', async () => {
|
|||||||
].join(' '),
|
].join(' '),
|
||||||
undefined, // args
|
undefined, // args
|
||||||
{
|
{
|
||||||
cwd: archiveFolder
|
cwd: archiveFolder,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -282,7 +298,8 @@ test('zstd create tar with windows BSDtar', async () => {
|
|||||||
].join(' '),
|
].join(' '),
|
||||||
undefined, // args
|
undefined, // args
|
||||||
{
|
{
|
||||||
cwd: archiveFolder
|
cwd: archiveFolder,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -322,7 +339,8 @@ test('gzip create tar', async () => {
|
|||||||
.join(' '),
|
.join(' '),
|
||||||
undefined, // args
|
undefined, // args
|
||||||
{
|
{
|
||||||
cwd: archiveFolder
|
cwd: archiveFolder,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -353,7 +371,10 @@ test('zstd list tar', async () => {
|
|||||||
])
|
])
|
||||||
.join(' '),
|
.join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -378,7 +399,10 @@ test('zstd list tar with windows BSDtar', async () => {
|
|||||||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
||||||
].join(' '),
|
].join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(execMock).toHaveBeenNthCalledWith(
|
expect(execMock).toHaveBeenNthCalledWith(
|
||||||
@@ -390,7 +414,10 @@ test('zstd list tar with windows BSDtar', async () => {
|
|||||||
'-P'
|
'-P'
|
||||||
].join(' '),
|
].join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -418,7 +445,10 @@ test('zstdWithoutLong list tar', async () => {
|
|||||||
.concat(['--use-compress-program', IS_WINDOWS ? '"zstd -d"' : 'unzstd'])
|
.concat(['--use-compress-program', IS_WINDOWS ? '"zstd -d"' : 'unzstd'])
|
||||||
.join(' '),
|
.join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -444,6 +474,9 @@ test('gzip list tar', async () => {
|
|||||||
.concat(['-z'])
|
.concat(['-z'])
|
||||||
.join(' '),
|
.join(' '),
|
||||||
undefined,
|
undefined,
|
||||||
{cwd: undefined}
|
{
|
||||||
|
cwd: undefined,
|
||||||
|
env: expect.objectContaining(defaultEnv)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.1.2",
|
"version": "3.1.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.1.2",
|
"version": "3.1.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.1.2",
|
"version": "3.1.4",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions cache lib",
|
"description": "Actions cache lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
+11
-11
@@ -71,11 +71,15 @@ export async function unlinkFile(filePath: fs.PathLike): Promise<void> {
|
|||||||
return util.promisify(fs.unlink)(filePath)
|
return util.promisify(fs.unlink)(filePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getVersion(app: string): Promise<string> {
|
async function getVersion(
|
||||||
core.debug(`Checking ${app} --version`)
|
app: string,
|
||||||
|
additionalArgs: string[] = []
|
||||||
|
): Promise<string> {
|
||||||
let versionOutput = ''
|
let versionOutput = ''
|
||||||
|
additionalArgs.push('--version')
|
||||||
|
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`)
|
||||||
try {
|
try {
|
||||||
await exec.exec(`${app} --version`, [], {
|
await exec.exec(`${app}`, additionalArgs, {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
@@ -94,18 +98,14 @@ async function getVersion(app: string): Promise<string> {
|
|||||||
|
|
||||||
// Use zstandard if possible to maximize cache performance
|
// Use zstandard if possible to maximize cache performance
|
||||||
export async function getCompressionMethod(): Promise<CompressionMethod> {
|
export async function getCompressionMethod(): Promise<CompressionMethod> {
|
||||||
const versionOutput = await getVersion('zstd')
|
const versionOutput = await getVersion('zstd', ['--quiet'])
|
||||||
const version = semver.clean(versionOutput)
|
const version = semver.clean(versionOutput)
|
||||||
|
core.debug(`zstd version: ${version}`)
|
||||||
|
|
||||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
if (versionOutput === '') {
|
||||||
// zstd is not installed
|
|
||||||
return CompressionMethod.Gzip
|
return CompressionMethod.Gzip
|
||||||
} else if (!version || semver.lt(version, 'v1.3.2')) {
|
|
||||||
// zstd is installed but using a version earlier than v1.3.2
|
|
||||||
// v1.3.2 is required to use the `--long` options in zstd
|
|
||||||
return CompressionMethod.ZstdWithoutLong
|
|
||||||
} else {
|
} else {
|
||||||
return CompressionMethod.Zstd
|
return CompressionMethod.ZstdWithoutLong
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-3
@@ -1,5 +1,4 @@
|
|||||||
import {exec} from '@actions/exec'
|
import {exec} from '@actions/exec'
|
||||||
import {exportVariable} from '@actions/core'
|
|
||||||
import * as io from '@actions/io'
|
import * as io from '@actions/io'
|
||||||
import {existsSync, writeFileSync} from 'fs'
|
import {existsSync, writeFileSync} from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
@@ -14,7 +13,6 @@ import {
|
|||||||
} from './constants'
|
} from './constants'
|
||||||
|
|
||||||
const IS_WINDOWS = process.platform === 'win32'
|
const IS_WINDOWS = process.platform === 'win32'
|
||||||
exportVariable('MSYS', 'winsymlinks:nativestrict')
|
|
||||||
|
|
||||||
// Returns tar path and type: BSD or GNU
|
// Returns tar path and type: BSD or GNU
|
||||||
async function getTarPath(): Promise<ArchiveTool> {
|
async function getTarPath(): Promise<ArchiveTool> {
|
||||||
@@ -250,7 +248,10 @@ async function getCompressionProgram(
|
|||||||
async function execCommands(commands: string[], cwd?: string): Promise<void> {
|
async function execCommands(commands: string[], cwd?: string): Promise<void> {
|
||||||
for (const command of commands) {
|
for (const command of commands) {
|
||||||
try {
|
try {
|
||||||
await exec(command, undefined, {cwd})
|
await exec(command, undefined, {
|
||||||
|
cwd,
|
||||||
|
env: {...(process.env as object), MSYS: 'winsymlinks:nativestrict'}
|
||||||
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${command.split(' ')[0]} failed with error: ${error?.message}`
|
`${command.split(' ')[0]} failed with error: ${error?.message}`
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ const result = await core.group('Do something async', async () => {
|
|||||||
|
|
||||||
This library has 3 methods that will produce [annotations](https://docs.github.com/en/rest/reference/checks#create-a-check-run).
|
This library has 3 methods that will produce [annotations](https://docs.github.com/en/rest/reference/checks#create-a-check-run).
|
||||||
```js
|
```js
|
||||||
core.error('This is a bad error. This will also fail the build.')
|
core.error('This is a bad error, action may still succeed though.')
|
||||||
|
|
||||||
core.warning('Something went wrong, but it\'s not bad enough to fail the build.')
|
core.warning('Something went wrong, but it\'s not bad enough to fail the build.')
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
# @actions/glob Releases
|
# @actions/glob Releases
|
||||||
|
|
||||||
|
### 0.4.0
|
||||||
|
- Pass in the current workspace as a parameter to HashFiles [#1318](https://github.com/actions/toolkit/pull/1318)
|
||||||
|
|
||||||
### 0.3.0
|
### 0.3.0
|
||||||
- Added a `verbose` option to HashFiles [#1052](https://github.com/actions/toolkit/pull/1052/files)
|
- Added a `verbose` option to HashFiles [#1052](https://github.com/actions/toolkit/pull/1052/files)
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ describe('globber', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const emptyDirectory = ''
|
||||||
it('followSymbolicLinks set to true', async () => {
|
it('followSymbolicLinks set to true', async () => {
|
||||||
const root = path.join(getTestTemp(), 'set-to-true')
|
const root = path.join(getTestTemp(), 'set-to-true')
|
||||||
await fs.mkdir(path.join(root, 'realdir'), {recursive: true})
|
await fs.mkdir(path.join(root, 'realdir'), {recursive: true})
|
||||||
@@ -60,7 +61,9 @@ describe('globber', () => {
|
|||||||
path.join(root, 'symDir')
|
path.join(root, 'symDir')
|
||||||
)
|
)
|
||||||
const testPath = path.join(root, `symDir`)
|
const testPath = path.join(root, `symDir`)
|
||||||
const hash = await hashFiles(testPath, {followSymbolicLinks: true})
|
const hash = await hashFiles(testPath, emptyDirectory, {
|
||||||
|
followSymbolicLinks: true
|
||||||
|
})
|
||||||
expect(hash).toEqual(
|
expect(hash).toEqual(
|
||||||
'd8a411e8f8643821bed189e627ff57151918aa554c00c10b31c693ab2dded273'
|
'd8a411e8f8643821bed189e627ff57151918aa554c00c10b31c693ab2dded273'
|
||||||
)
|
)
|
||||||
@@ -80,7 +83,9 @@ describe('globber', () => {
|
|||||||
path.join(root, 'symDir')
|
path.join(root, 'symDir')
|
||||||
)
|
)
|
||||||
const testPath = path.join(root, 'symdir')
|
const testPath = path.join(root, 'symdir')
|
||||||
const hash = await hashFiles(testPath, {followSymbolicLinks: false})
|
const hash = await hashFiles(testPath, emptyDirectory, {
|
||||||
|
followSymbolicLinks: false
|
||||||
|
})
|
||||||
expect(hash).toEqual('')
|
expect(hash).toEqual('')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/glob",
|
"name": "@actions/glob",
|
||||||
"version": "0.3.0",
|
"version": "0.4.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/glob",
|
"name": "@actions/glob",
|
||||||
"version": "0.3.0",
|
"version": "0.4.0",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions glob lib",
|
"description": "Actions glob lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -22,10 +22,13 @@ export async function create(
|
|||||||
* Computes the sha256 hash of a glob
|
* Computes the sha256 hash of a glob
|
||||||
*
|
*
|
||||||
* @param patterns Patterns separated by newlines
|
* @param patterns Patterns separated by newlines
|
||||||
|
* @param currentWorkspace Workspace used when matching files
|
||||||
* @param options Glob options
|
* @param options Glob options
|
||||||
|
* @param verbose Enables verbose logging
|
||||||
*/
|
*/
|
||||||
export async function hashFiles(
|
export async function hashFiles(
|
||||||
patterns: string,
|
patterns: string,
|
||||||
|
currentWorkspace = '',
|
||||||
options?: HashFileOptions,
|
options?: HashFileOptions,
|
||||||
verbose: Boolean = false
|
verbose: Boolean = false
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
@@ -34,5 +37,5 @@ export async function hashFiles(
|
|||||||
followSymbolicLinks = options.followSymbolicLinks
|
followSymbolicLinks = options.followSymbolicLinks
|
||||||
}
|
}
|
||||||
const globber = await create(patterns, {followSymbolicLinks})
|
const globber = await create(patterns, {followSymbolicLinks})
|
||||||
return _hashFiles(globber, verbose)
|
return _hashFiles(globber, currentWorkspace, verbose)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,14 @@ import {Globber} from './glob'
|
|||||||
|
|
||||||
export async function hashFiles(
|
export async function hashFiles(
|
||||||
globber: Globber,
|
globber: Globber,
|
||||||
|
currentWorkspace: string,
|
||||||
verbose: Boolean = false
|
verbose: Boolean = false
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const writeDelegate = verbose ? core.info : core.debug
|
const writeDelegate = verbose ? core.info : core.debug
|
||||||
let hasMatch = false
|
let hasMatch = false
|
||||||
const githubWorkspace = process.env['GITHUB_WORKSPACE'] ?? process.cwd()
|
const githubWorkspace = currentWorkspace
|
||||||
|
? currentWorkspace
|
||||||
|
: process.env['GITHUB_WORKSPACE'] ?? process.cwd()
|
||||||
const result = crypto.createHash('sha256')
|
const result = crypto.createHash('sha256')
|
||||||
let count = 0
|
let count = 0
|
||||||
for await (const file of globber.globGenerator()) {
|
for await (const file of globber.globGenerator()) {
|
||||||
|
|||||||
@@ -145,6 +145,44 @@ describe('proxy', () => {
|
|||||||
expect(bypass).toBeFalsy()
|
expect(bypass).toBeFalsy()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('checkBypass returns true if host with subdomain in no_proxy', () => {
|
||||||
|
process.env['no_proxy'] = 'myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://sub.myserver.com'))
|
||||||
|
expect(bypass).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('checkBypass returns false if no_proxy is subdomain', () => {
|
||||||
|
process.env['no_proxy'] = 'myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://myserver.com.evil.org'))
|
||||||
|
expect(bypass).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('checkBypass returns false if no_proxy is part of domain', () => {
|
||||||
|
process.env['no_proxy'] = 'myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://evilmyserver.com'))
|
||||||
|
expect(bypass).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Do not strip leading dots as per https://github.com/actions/runner/blob/97195bad5870e2ad0915ebfef1616083aacf5818/docs/adrs/0263-proxy-support.md
|
||||||
|
it('checkBypass returns false if host with leading dot in no_proxy', () => {
|
||||||
|
process.env['no_proxy'] = '.myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://myserver.com'))
|
||||||
|
expect(bypass).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('checkBypass returns true if host with subdomain in no_proxy defined with leading "."', () => {
|
||||||
|
process.env['no_proxy'] = '.myserver.com'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://sub.myserver.com'))
|
||||||
|
expect(bypass).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Do not match wildcard ("*") as per https://github.com/actions/runner/blob/97195bad5870e2ad0915ebfef1616083aacf5818/docs/adrs/0263-proxy-support.md
|
||||||
|
it('checkBypass returns true if no_proxy is "*"', () => {
|
||||||
|
process.env['no_proxy'] = '*'
|
||||||
|
const bypass = pm.checkBypass(new URL('https://anything.whatsoever.com'))
|
||||||
|
expect(bypass).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
it('HttpClient does basic http get request through proxy', async () => {
|
it('HttpClient does basic http get request through proxy', async () => {
|
||||||
process.env['http_proxy'] = _proxyUrl
|
process.env['http_proxy'] = _proxyUrl
|
||||||
const httpClient = new httpm.HttpClient()
|
const httpClient = new httpm.HttpClient()
|
||||||
|
|||||||
@@ -51,7 +51,15 @@ export function checkBypass(reqUrl: URL): boolean {
|
|||||||
.split(',')
|
.split(',')
|
||||||
.map(x => x.trim().toUpperCase())
|
.map(x => x.trim().toUpperCase())
|
||||||
.filter(x => x)) {
|
.filter(x => x)) {
|
||||||
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
if (
|
||||||
|
upperReqHosts.some(
|
||||||
|
x =>
|
||||||
|
x === upperNoProxyItem ||
|
||||||
|
x.endsWith(`.${upperNoProxyItem}`) ||
|
||||||
|
(upperNoProxyItem.startsWith('.') &&
|
||||||
|
x.endsWith(`${upperNoProxyItem}`))
|
||||||
|
)
|
||||||
|
) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user