1
0
Fork 0

Merge pull request #767 from actions/dhadka/fix-permissions

Fix permissions issues using gtar on mac
pull/770/head
David Hadka 2021-04-09 14:34:51 -05:00 committed by GitHub
commit 634dc61da2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 10 deletions

View File

@ -37,3 +37,6 @@
### 1.0.6
- Make caching more verbose [#650](https://github.com/actions/toolkit/pull/650)
- Use GNU tar on macOS if available [#701](https://github.com/actions/toolkit/pull/701)
### 1.0.7
- Fixes permissions issue extracting archives with GNU tar on macOS ([issue](https://github.com/actions/cache/issues/527))

View File

@ -11,6 +11,7 @@ jest.mock('@actions/exec')
jest.mock('@actions/io')
const IS_WINDOWS = process.platform === 'win32'
const IS_MAC = process.platform === 'darwin'
const defaultTarPath = process.platform === 'darwin' ? 'gtar' : 'tar'
@ -55,7 +56,9 @@ test('zstd extract tar', async () => {
'-P',
'-C',
IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace
].concat(IS_WINDOWS ? ['--force-local'] : []),
]
.concat(IS_WINDOWS ? ['--force-local'] : [])
.concat(IS_MAC ? ['--delay-directory-restore'] : []),
{cwd: undefined}
)
})
@ -84,7 +87,7 @@ test('gzip extract tar', async () => {
'-P',
'-C',
IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace
],
].concat(IS_MAC ? ['--delay-directory-restore'] : []),
{cwd: undefined}
)
})
@ -145,7 +148,9 @@ test('zstd create tar', async () => {
IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace,
'--files-from',
'manifest.txt'
].concat(IS_WINDOWS ? ['--force-local'] : []),
]
.concat(IS_WINDOWS ? ['--force-local'] : [])
.concat(IS_MAC ? ['--delay-directory-restore'] : []),
{
cwd: archiveFolder
}
@ -180,7 +185,7 @@ test('gzip create tar', async () => {
IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace,
'--files-from',
'manifest.txt'
],
].concat(IS_MAC ? ['--delay-directory-restore'] : []),
{
cwd: archiveFolder
}
@ -205,7 +210,9 @@ test('zstd list tar', async () => {
'-tf',
IS_WINDOWS ? archivePath.replace(/\\/g, '/') : archivePath,
'-P'
].concat(IS_WINDOWS ? ['--force-local'] : []),
]
.concat(IS_WINDOWS ? ['--force-local'] : [])
.concat(IS_MAC ? ['--delay-directory-restore'] : []),
{cwd: undefined}
)
})
@ -228,7 +235,9 @@ test('zstdWithoutLong list tar', async () => {
'-tf',
IS_WINDOWS ? archivePath.replace(/\\/g, '/') : archivePath,
'-P'
].concat(IS_WINDOWS ? ['--force-local'] : []),
]
.concat(IS_WINDOWS ? ['--force-local'] : [])
.concat(IS_MAC ? ['--delay-directory-restore'] : []),
{cwd: undefined}
)
})
@ -252,7 +261,7 @@ test('gzip list tar', async () => {
'-tf',
IS_WINDOWS ? archivePath.replace(/\\/g, '/') : archivePath,
'-P'
],
].concat(IS_MAC ? ['--delay-directory-restore'] : []),
{cwd: undefined}
)
})

2
packages/cache/package-lock.json generated vendored
View File

@ -1,6 +1,6 @@
{
"name": "@actions/cache",
"version": "1.0.6",
"version": "1.0.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@actions/cache",
"version": "1.0.6",
"version": "1.0.7",
"preview": true,
"description": "Actions cache lib",
"keywords": [

View File

@ -26,6 +26,8 @@ async function getTarPath(
case 'darwin': {
const gnuTar = await io.which('gtar', false)
if (gnuTar) {
// fix permission denied errors when extracting BSD tar archive with GNU tar - https://github.com/actions/cache/issues/527
args.push('--delay-directory-restore')
return gnuTar
}
break