Giter Club home page Giter Club logo

gh-dev-branch's Introduction

gh-dev-branch

Build Lint CodeQL Analysis Go Report Card

GitHub CLI extension to generate meaningful branch names off of issues.

This is a simple extension that helps generate meaningful names for branches as soon as you want to start working on a given issue.

Think of it as the CLI counterpart for the beta feature of development branches that can be created in the GitHub UI, as documented here: https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-a-branch-for-an-issue

Installation

gh extension install rm3l/gh-dev-branch

Usage

❯ gh dev-branch -h

Usage: gh dev-branch <issue> [options]
Options:
  -max-length int
        max length of generated branch name (default -1)
  -repo string
        repository to use for finding the issue

Examples

# Using the current directory. Base repo is determined from the current Git repository
❯ gh dev-branch 294
294-could-not-find-unspecified-when-importing-transitive-dependencies

# or you can use the result in other commands, like to create and switch to that new branch
❯ git switch -c `gh dev-branch 294`     
Switched to a new branch '294-could-not-find-unspecified-when-importing-transitive-dependencies'

Or

# Using an issue from any other GitHub repo
❯ gh dev-branch 9792 -repo openwrt/openwrt
9792-feature-request-deterministic-configuration-export

Working with the source code

  1. Clone the repository:
git clone https://github.com/rm3l/gh-dev-branch
cd gh-dev-branch
  1. Download and install Go to build the project. Or if you are already using the asdf version manager, you can just run asdf install to install all the necessary tools (declared in the .tool-versions file).

  2. Install the local version of this extension; gh symlinks to your local source code directory.

# Install the local version
gh extension install .
  1. At this point, you can start using it:
gh dev-branch <my-issue-number> [-repo <my_org/my_repo>]
  1. To see changes in the code as you develop, simply build and use the extension
go build && gh dev-branch <my-issue-number> [-repo <my_org/my_repo>]

Contribution Guidelines

Contributions and issue reporting are more than welcome. So to help out, do feel free to fork this repo and open up a pull request. I'll review and merge your changes as quickly as possible.

You can use GitHub issues to report bugs. However, please make sure your description is clear enough and has sufficient instructions to be able to reproduce the issue.

Developed by

License

The MIT License (MIT)

Copyright (c) 2022-2023 Armel Soro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

gh-dev-branch's People

Contributors

dependabot[bot] avatar rm3l avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kevariste225

gh-dev-branch's Issues

Add support for secure token storage

Token storage change in latest release of gh

This is a message from the GitHub CLI team, maintainers of gh, writing to inform you that the most recent release of gh contains changes which may affect your extension. The latest release introduces the feature of storing authentication tokens in the system keyring (encrypted storage) instead of in a plain text file.
The keyrings that are supported are:

  • Keychain on macOS

  • GNOME Keyring on Linux (Secret Service dbus interface)

  • Wincred on Windows

This has huge security benefits for the users of our tool and was one of our oldest outstanding issues. Unfortunately this change has the potential to break extensions that rely on utilizing the users authentication token to work.

In order to have continued compatibility with gh there are some actions you, as an extension author, need to take. These actions will depend on the implementation of your extension.

Extensions built in Go using go-gh:

  1. Upgrade your go-gh version to v1.2.1, the latest version.

  2. Verify that in your extension retrieval of the user authentication token is done using the auth.TokenForHost function.

    • If you were previously accessing the authentication token using any other method it will no longer work.
    • Automatic resolution of the authentication token when using the API clients will continue to work without changes.

All other extensions:

  1. Verify that in your extension retrieval of the user authentication token is done by shelling out to the gh auth token command.

    • If you were previously accessing the authentication token using the gh config get command, reading the configuration file directly, or any other methods it will no longer work.

As of right now storing the authentication token in the system keyring is an opt-in feature, but in the near future it will be required and at that point if the changes above are not made then your extension will be broken for all users. If you have any questions/concerns about this change please feel free to open a discussion in the gh repo.

Thanks,
The GitHub CLI Team

Generated branch name might be invalid for Git

Issue title was Collect metrics for issues, pull requests, ...

$ git switch -c `gh dev-branch 6993`
fatal: '6993-collect-metrics-for-issues-pull-requests-..' is not a valid branch name

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.