Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

delete-github-branches

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delete-github-branches

Delete GitHub Branches that match patterns.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
241
decreased by-1.63%
Maintainers
1
Weekly downloads
 
Created
Source

delete-github-branches

Delete GitHub Branches that match patterns.

Features

  • Can define includesBranchPatterns
  • Can define excludesBranchPatterns
  • If the branch has associated Pull Requests, Does not delete the branch
  • Have dryRun mode

Install

Install with npm:

npm install delete-github-branches

Usage: CLI

Usage
  $ delete-github-branches

Options
  --owner Owner name for repository: **owner**/repo
  --repo  Repo name for repository: owner/**repo**
  --token GitHub Token. you can use als GITHUB_TOKEN env
  --includesBranchPatterns includes branch patterns split by command. 
  --excludesBranchPatterns excludes branch patterns split by command. "master,develop,developer"
  --baseUrl GitHub API base Url.
  --dryRun if this flag is on, run dry-run mode

Examples
  $ delete-github-branches --owner azu --repo delete-github-branches-test --token <TOKEN>
  $ delete-github-branches --owner azu --repo delete-github-branches-test --token <TOKEN> --includesBranchPatterns "/feature\/.*/" --dryRun

Usage: Library

(async () => {
    const results = await deleteGitHubBranches({
        owner: "azu",
        repo: "delete-github-branches-test",
        excludesBranchPatterns: ["master", "develop", "/feature/.*/"],
        GITHUB_TOKEN: process.env.GITHUB_TOKEN!,
        dryRun: true // <= dry run mode
    });
    assert.deepStrictEqual(results, [
        { branchName: "develop", deleted: false, reason: "It is ignored by includes/excludes patterns" },
        { branchName: "feature/a", deleted: false, reason: "It is ignored by includes/excludes patterns" },
        { branchName: "feature/b", deleted: false, reason: "It is ignored by includes/excludes patterns" },
        { branchName: "master", deleted: false, reason: "It is ignored by includes/excludes patterns" },
        { branchName: "will-be-deleted", deleted: true }
    ]);
})()

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu

Keywords

FAQs

Package last updated on 02 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc