From ad2fd7b5e6069300af28654acc5deab5b60536c2 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Wed, 1 Jun 2022 13:18:50 +0000 Subject: [PATCH] Adding fix for tar exiting with code 1 issue --- RELEASES.md | 5 ++++- package.json | 2 +- src/internal/tar.ts | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 133be52..0c17c5e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -64,4 +64,7 @@ - Update to v2.0.1 of `@actions/http-client` [#1087](https://github.com/actions/toolkit/pull/1087) ### 2.0.5 -- Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) \ No newline at end of file +- Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) + +### 2.0.6 +- Fix `Tar failed with error: The process '/usr/bin/tar' failed with exit code 1` issue when temp directory where tar is getting created is actually the subdirectory of the path mentioned by the user for caching. ([issue](https://github.com/actions/cache/issues/689)) diff --git a/package.json b/package.json index 813ac88..d2f8d10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "2.0.5", + "version": "2.0.6", "preview": true, "description": "Actions cache lib", "keywords": [ diff --git a/src/internal/tar.ts b/src/internal/tar.ts index fbea7c2..c809191 100644 --- a/src/internal/tar.ts +++ b/src/internal/tar.ts @@ -118,6 +118,8 @@ export async function createTar( ...getCompressionProgram(), '-cf', cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), + '--exclude', + cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),