Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

github-remove-all-releases

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-remove-all-releases - npm Package Compare versions

Comparing version
0.0.0
to
1.0.0
+30
-4
cli.js

@@ -12,10 +12,36 @@ #!/usr/bin/env node

'Example',
' github-remove-all-releases stevemao github-remove-all-releases',
' github-remove-all-releases stevemao github-remove-all-releases -t cde5078435862fe1c8af8af4b582460b95e8ec30',
' github-remove-all-releases stevemao github-repo',
' github-remove-all-releases stevemao github-repo -t cde5078435862fe1c8af8af4b582460b95e8ec30',
'',
'Options',
' -t, --token Your auth token'
' -t, --token Your auth token',
' -v, --verbose Verbose output'
]
}, {
alias: {
t: 'token',
v: 'verbose'
}
});
githubRemoveAllReleases(cli.input[0]);
var input = cli.input;
var flags = cli.flags;
try {
githubRemoveAllReleases({
type: 'oauth',
token: flags.token || process.env.GITHUB_REMOVE_ALL_RELEASES_TOKEN
}, input[0], input[1], function(err, data) {
if (err) {
console.error(err.toString());
process.exit(1);
}
if (flags.verbose) {
console.log(data);
}
});
} catch (err) {
console.error(err.toString());
process.exit(1);
}
+39
-10

@@ -9,3 +9,3 @@ 'use strict';

function githubRemoveAllReleases(auth, options, done) {
function githubRemoveAllReleases(auth, owner, repo, done, filter) {
if (!auth) {

@@ -15,14 +15,41 @@ throw new Error('Expected an auth object');

if (typeof owner !== 'string') {
throw new Error('owner must be a string');
}
if (typeof repo !== 'string') {
throw new Error('repo must be a string');
}
if (typeof done !== 'function') {
throw new Error('Expected a callback');
}
if (typeof filter !== 'function') {
filter = function() {
return true;
};
}
github.authenticate(auth);
Q.nfcall(github.releases.listReleases, options)
Q.nfcall(github.releases.listReleases, {
owner: owner,
repo: repo
})
.then(function(data) {
var deleteReleasePromises = [];
if (data.length === 0) {
throw new Error('No releases found');
}
data.forEach(function(release) {
deleteReleasePromises.push(Q.nfcall(github.releases.deleteRelease, {
owner: options.owner,
repo: options.repo,
id: release.id
}));
if (filter(release)) {
deleteReleasePromises.push(Q.nfcall(github.releases.deleteRelease, {
owner: owner,
repo: repo,
id: release.id
}));
}
});

@@ -32,7 +59,9 @@

})
.then(function() {
done();
}, done);
.then(function(data) {
setImmediate(done, null, data);
}, function(err) {
setImmediate(done, err);
});
}
module.exports = githubRemoveAllReleases;
{
"name": "github-remove-all-releases",
"version": "0.0.0",
"description": "Remove all releases of your GitHub repo",
"version": "1.0.0",
"description": "Remove all releases of a GitHub repo",
"homepage": "https://github.com/stevemao/github-remove-all-releases",

@@ -41,5 +41,5 @@ "author": {

"scripts": {
"coverage": "istanbul cover _mocha -- -R spec --timeout 10000 && rm -rf ./coverage",
"coverage": "istanbul cover -x test.js _mocha -- -R spec --timeout 50000 && rm -rf ./coverage",
"lint": "jshint *.js --exclude node_modules && jscs *.js",
"test": "npm run-script lint && mocha --timeout 10000"
"test": "npm run-script lint && mocha --timeout 50000"
},

@@ -46,0 +46,0 @@ "bin": {

# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coverall-image]][coverall-url]
> Remove all releases of your GitHub repo
> Remove all releases of a GitHub repo

@@ -18,3 +18,8 @@

githubRemoveAllReleases('Rainbow');
var AUTH = {
type: "oauth",
token: '0126af95c0e2d9b0a7c78738c4c00a860b04acc8'
};
githubRemoveAllReleases(AUTH, 'stevemaotest', 'github-remove-all-releases-test', callback);
```

@@ -25,5 +30,68 @@

$ github-remove-all-releases --help
Remove all releases of a GitHub repo
Usage
github-remove-all-releases <owner> <repo>
Example
github-remove-all-releases stevemao github-repo
github-remove-all-releases stevemao github-repo -t cde5078435862fe1c8af8af4b582460b95e8ec30
Options
-t, --token Your auth token
-v, --verbose Verbose output
```
## API
### githubRemoveAllReleases(auth, owner, repo, callback, [filter])
### auth
An auth object passed to [node-github](https://github.com/mikedeboer/node-github#authentication).
### owner
Type: `string`
The owner of the repo.
### repo
Type: `string`
The repo you want your releases deleted from.
### callback
#### function(err, data)
##### data
Type: `array`
A list of deleted releases.
### filter
Type: `function` Default: always return `true`
#### function(release)
A custom filter function. All the releases will be passed as the only argument of this function. If return `true`, this release will be removed.
## CLI
You can supply your auth token by a flag `-t` or `--token`. You can also [set up an environment variable](https://www.google.com.au/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=how%20to%20set%20environment%20variable) `CONVENTIONAL_GITHUB_RELEASER_TOKEN` to avoid typing your token every time. [Create a new token](https://github.com/settings/tokens/new) if you haven't.
## Related
- [conventional-github-releaser](https://github.com/stevemao/conventional-github-releaser) - Make a new GitHub release from git metadata
- [github-remove-forks](https://github.com/kevva/github-remove-forks) - Remove all forked repositories
## License

@@ -30,0 +98,0 @@