Allow inactive repo deletion without code

ft/strip-markdown
KaKi87 2 months ago
parent 5e58e67044
commit 57124572ef

@ -110,21 +110,31 @@ if(id){
case '2': {
const
{
status,
data: {
deletionCode
} = {}
} = await client.delete(
`/repo/${id}`,
{
validateStatus: status => [202, 204].includes(status)
}
} = await client.delete(`/repo/${id}`),
hash = prompt(outdent `
);
if(status === 202){
const hash = prompt(outdent `
Deletion code: ${deletionCode}
Push a commit which message ends with it.
Hash >
`);
if(await validateAction({
action: 'delete',
id,
hash
})) console.log('[✓] Success');
else console.error('[!] Validation failed');
if(await validateAction({
action: 'delete',
id,
hash
})) console.log('[✓] Success');
else console.error('[!] Validation failed');
}
else
console.log('[✓] Success');
break;
}
default: {

@ -313,11 +313,14 @@ createRoute({
host,
owner,
name,
isActive,
deletionCode
} = await repos.findOne({ _id: id }) || {};
if(host && owner && name){
if(hash){
if(!isActive || hash){
if(
!isActive
||
(await axios({
baseURL: `https://${host}/api/v1`,
url: `/repos/${owner}/${name}/git/commits/${hash}`,
@ -342,6 +345,7 @@ createRoute({
}
);
}
response.code(202);
response.body = {
deletionCode
};

Loading…
Cancel
Save