@codefresh-io/cf-git-providers
Advanced tools
Comparing version
@@ -34,2 +34,4 @@ "use strict"; | ||
const fs_1 = require("fs"); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const CFError = require('cf-errors'); | ||
exports.to = async (fn) => { | ||
@@ -112,10 +114,20 @@ try { | ||
} | ||
await git.clone({ fs: nodefs, http, dir, url, onAuth: () => (auth) }); | ||
await git.tag({ fs: nodefs, dir, force: true, ref: tag }); | ||
// attempt to push the tag to verify write permissions | ||
await git.push({ fs: nodefs, http, dir, force: true, onAuth: () => (auth) }); | ||
// delete and push the write check tag | ||
await git.deleteTag({ fs: nodefs, dir, ref: tag }); | ||
await git.push({ fs: nodefs, http, dir, force: true, onAuth: () => (auth) }); | ||
try { | ||
await git.clone({ fs: nodefs, http, dir, url, onAuth: () => (auth) }); | ||
await git.tag({ fs: nodefs, dir, force: true, ref: tag }); | ||
// attempt to push the tag to verify write permissions | ||
await git.push({ fs: nodefs, http, dir, force: true, onAuth: () => (auth) }); | ||
// delete and push the write check tag | ||
await git.deleteTag({ fs: nodefs, dir, ref: tag }); | ||
await git.push({ fs: nodefs, http, dir, force: true, onAuth: () => (auth) }); | ||
} | ||
catch (error) { | ||
if (error instanceof git.Errors.HttpError) { | ||
const statusCode = error.data.statusCode; | ||
if (statusCode == 401 || statusCode == 403) { | ||
throw new CFError(`ValidationError: check your token permissions, failed assert write scopes with ${error}`); | ||
} | ||
} | ||
} | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@codefresh-io/cf-git-providers", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "An NPM module/CLI for interacting with various git providers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
334478
0.24%4503
0.27%