Skip to content

Commit

Permalink
Skip delete errors on the post step
Browse files Browse the repository at this point in the history
  • Loading branch information
goanpeca committed Aug 19, 2020
1 parent d6bafe2 commit c961936
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion dist/delete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,14 @@ function run() {
fs.lstatSync(fullPath).isDirectory() &&
folder_or_file != "cache") {
core.info(`Removing "${fullPath}"`);
yield io.rmRF(fullPath);
try {
yield io.rmRF(fullPath);
}
catch (err) {
// If file could not be deleted, move to a temp folder
core.info(`Remove failed, moving "${fullPath}" to temp folder`);
yield io.mv(fullPath, path.join(os.tmpdir(), folder_or_file));
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29090,7 +29090,7 @@ module.exports = defaults;
/* 771 */
/***/ (function(module) {

module.exports = {"_args":[["[email protected]","/Users/bryan/GitHub/setup-miniconda"]],"_from":"[email protected]","_id":"[email protected]","_inBundle":false,"_integrity":"sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==","_location":"/cheerio","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"[email protected]","name":"cheerio","escapedName":"cheerio","rawSpec":"1.0.0-rc.3","saveSpec":null,"fetchSpec":"1.0.0-rc.3"},"_requiredBy":["/get-hrefs"],"_resolved":"https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz","_spec":"1.0.0-rc.3","_where":"/Users/bryan/GitHub/setup-miniconda","author":{"name":"Matt Mueller","email":"[email protected]","url":"mat.io"},"bugs":{"url":"https://github.com/cheeriojs/cheerio/issues"},"dependencies":{"css-select":"~1.2.0","dom-serializer":"~0.1.1","entities":"~1.1.1","htmlparser2":"^3.9.1","lodash":"^4.15.0","parse5":"^3.0.1"},"description":"Tiny, fast, and elegant implementation of core jQuery designed specifically for the server","devDependencies":{"benchmark":"^2.1.0","coveralls":"^2.11.9","expect.js":"~0.3.1","istanbul":"^0.4.3","jquery":"^3.0.0","jsdom":"^9.2.1","jshint":"^2.9.2","mocha":"^3.1.2","xyz":"~1.1.0"},"engines":{"node":">= 0.6"},"files":["index.js","lib"],"homepage":"https://github.com/cheeriojs/cheerio#readme","keywords":["htmlparser","jquery","selector","scraper","parser","html"],"license":"MIT","main":"./index.js","name":"cheerio","repository":{"type":"git","url":"git://github.com/cheeriojs/cheerio.git"},"scripts":{"test":"make test"},"version":"1.0.0-rc.3"};
module.exports = {"_args":[["[email protected]","/Users/goanpeca/Dropbox (Personal)/develop/quansight/setup-miniconda"]],"_from":"[email protected]","_id":"[email protected]","_inBundle":false,"_integrity":"sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==","_location":"/cheerio","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"[email protected]","name":"cheerio","escapedName":"cheerio","rawSpec":"1.0.0-rc.3","saveSpec":null,"fetchSpec":"1.0.0-rc.3"},"_requiredBy":["/get-hrefs"],"_resolved":"https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz","_spec":"1.0.0-rc.3","_where":"/Users/goanpeca/Dropbox (Personal)/develop/quansight/setup-miniconda","author":{"name":"Matt Mueller","email":"[email protected]","url":"mat.io"},"bugs":{"url":"https://github.com/cheeriojs/cheerio/issues"},"dependencies":{"css-select":"~1.2.0","dom-serializer":"~0.1.1","entities":"~1.1.1","htmlparser2":"^3.9.1","lodash":"^4.15.0","parse5":"^3.0.1"},"description":"Tiny, fast, and elegant implementation of core jQuery designed specifically for the server","devDependencies":{"benchmark":"^2.1.0","coveralls":"^2.11.9","expect.js":"~0.3.1","istanbul":"^0.4.3","jquery":"^3.0.0","jsdom":"^9.2.1","jshint":"^2.9.2","mocha":"^3.1.2","xyz":"~1.1.0"},"engines":{"node":">= 0.6"},"files":["index.js","lib"],"homepage":"https://github.com/cheeriojs/cheerio#readme","keywords":["htmlparser","jquery","selector","scraper","parser","html"],"license":"MIT","main":"./index.js","name":"cheerio","repository":{"type":"git","url":"git://github.com/cheeriojs/cheerio.git"},"scripts":{"test":"make test"},"version":"1.0.0-rc.3"};

/***/ }),
/* 772 */
Expand Down
8 changes: 7 additions & 1 deletion src/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ async function run(): Promise<void> {
folder_or_file != "cache"
) {
core.info(`Removing "${fullPath}"`);
await io.rmRF(fullPath);
try {
await io.rmRF(fullPath);
} catch (err) {
// If file could not be deleted, move to a temp folder
core.info(`Remove failed, moving "${fullPath}" to temp folder`);
await io.mv(fullPath, path.join(os.tmpdir(), folder_or_file));
}
}
}
}
Expand Down

0 comments on commit c961936

Please sign in to comment.