Git Product home page Git Product logo

github-todos's Introduction

npm version Dependency Status Flattr this git repo Gittip donate

github-todos

Github-Todos is a git hook to convert your TODOs into Github issues.

You can read the full presentation from wiki for detailed information.

Basic usage

  • Install hook on your repository
# If you're not using Github, set service FIRST
github-todos config service bitbucket # check out github-todos list-services

github-todos init
  • Check and maybe tweak configuration
github-todos config --defaults

# want to enable issue injection?
github-todos config inject-issue true

# check configuration help
github-todos help config
  • Work, commit, push
[Github-Todos] Checking Github Authentication… OK
[Github-Todos] Created issue #11 (do something better) - https://github.com/user/repo/issues/11
[Github-Todos] Created issue #12 (add security filter) - https://github.com/user/repo/issues/12
[Github-Todos] Added comment to issue #12 (add security filter) - https://github.com/user/repo/issues/11/#…
[Github-Todos] Injecting issue numbers to files…
[Github-Todos] Added a commit containing issue injections

Install

npm install -g github-todos

Authenticate to Github

github-todos auth

Configuration

There seems to be a lot of options, but as this tool can have critical impact on your project (creating dumb issues, causing conflicts on workspace…) it's important for it to have conservative defaults, and for you to understand these options.

Use github-todos help config for more details (including formats). Here is a short-list of most probably useful options:

  • Repository configuration:
    • repo is the repository to create issues on (format: "user/repository", default: guessed from remote origin)
    • service is the issue service (default: "github", available: "github")
    • branches are the branches on which the hook will be enabled (default: master,develop)
    • remotes are the remotes on which the hook will be enabled (advice: setting more than one will cause duplicate issues when you will push the same commits to different enabled remotes, default: origin)
    • files are the files on which the hook will be enabled (default: **, prefix with a dash - to exclude, for example **,-vendors/**).
  • Detection:
    • label.<MARKER> enables a marker and associates a Github label to it (default: label.TODO=TODO and label.FIXME=TODO)
    • label-whitespace forces a whitespace to be found next to marker to trigger hook (default: true)
    • case-sensitive forces case sensitivity (default: false)
  • Others:
    • inject-issue hook will modify your files (and commit changes, after push) to add issue number next to TODOs (default: false)
    • confirm-create hook will ask for user confirmation before opening any new issue (default: true)
    • open-url will open issues and comments in your main browser (default: false)
    • context is the number of line you want to include in your issue or comment body (default: 3)

.github-todos-ignore

This file will contain all TODOs you wish to automatically ignore (false positives, issues that should not be created on purpose…).

For example, if your .github-todos-ignore file is as follows:

write something useful

and you're about to commit the following TODOs

+ TODO write something useful
+ TODO write something useful please

then the first one will be simply ignored.

Advanced usage

Environment variables

Some behavior can be altered using environment variables. Why not use CLI arguments? Because you may want to enable those options during a git push. For example DRY_RUN=1 git push to simulate safely, or NO_GITHUB_TODOS=1 git push for faster push.

  • set DRY_RUN=1 to simulate instead of really execute: in this mode no call to Github API will occur, and issues will not be injected even if inject-issue option is enabled.
    • Note that in this mode the git hook will fail, which should abort the git command
  • set NO_GITHUB_TODOS=1 to entirely disable Github-Todos.
  • set SHOW_TIME=1 to display the time spent in Github-Todos (if you suspect it dramatically slows down your git push, that can be a good start).
  • set DEBUG=github-todos to show verbose internal debugging information.

Cleanup

If you want to uninstall hook for current repository:

github-todos init --no-connect --uninstall

github-todos's People

Contributors

mohsen1 avatar naholyr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

github-todos's Issues

Is it possible to ignore files?

I have a repo which has a bunch of code in it which isn't mine. Moreover, this code has TODOs in it. I would like to ignore these files. In the example repo, these files are inside deps/fftw-3.3.4.

github-todos can break git push on very large commits

I recently tried to push a very large commit (thousands of lines changed). This resulted in github-todos printing so much to the stdout that the git push failed (exceeded buffer).

A very large css file (9000+lines) was printed to stdout. I suspect this was the cause of the issue, but I am not sure if it was the only problem.

If anyone else gets the same problem, you can do git push --no-verify to omit the githook.

Synchronize issues and TODOs both ways

For discussion, let's study possibilities:

  • Closing issue when a TODO is removed or "marked as complete"?
  • Remove TODOs when issue is closed?
  • Do it automatically? At push-time? In a separate command (brew doctor-like)?

Error on `github-todos init`

This project is really an awesome idea, it's something I think I was lacking. In fact, I was thinking of building something similar myself, then I discover your project. Kudos to you!

Anyway, I failed my first attempt at using it. After installation, when I try to configure it,
I was asked for GH user and password to generate an API token. I type my credentials,
but then I receive this error:

[Github-Todos] To disable checking credentials on 'init', add option '--no-connect'
[Github-Todos] Hook file not found, create new one…
[Github-Todos] Hook installed
[Github-Todos] Option 'repo' is not set
[Github-Todos] Now guessing initial configuration from remote 'origin'…
[Github-Todos] TypeError: Object parroit/immutato has no method 'then'
[Github-Todos] Failed to fetch 'repo' option
[Github-Todos] Now guessing initial configuration from remote 'origin'…
TypeError: Object parroit/immutato has no method 'then'

( parroit/immutato is my repo on GH )

Unhandled rejection ReferenceError: primordials is not defined

Using node v13.6.0 (64-bit) on Windows 10.

When I run github-todos init command, I receive this error:

Unhandled rejection ReferenceError: primordials is not defined
    at fs.js:35:5
    at req_ (C:\Users\joaos\AppData\Roaming\npm\node_modules\github-todos\node_modules\natives\index.js:143:24)
    at Object.req [as require] (C:\Users\joaos\AppData\Roaming\npm\node_modules\github-todos\node_modules\natives\index.js:55:10)
    at Object.<anonymous> (C:\Users\joaos\AppData\Roaming\npm\node_modules\github-todos\node_modules\graceful-fs\fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:1144:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
    at Module.load (internal/modules/cjs/loader.js:993:32)
    at Function.Module._load (internal/modules/cjs/loader.js:892:14)
    at Module.require (internal/modules/cjs/loader.js:1033:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\joaos\AppData\Roaming\npm\node_modules\github-todos\node_modules\graceful-fs\graceful-fs.js:3:27)
    at Module._compile (internal/modules/cjs/loader.js:1144:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
    at Module.load (internal/modules/cjs/loader.js:993:32)
    at Function.Module._load (internal/modules/cjs/loader.js:892:14)
    at Module.require (internal/modules/cjs/loader.js:1033:19)

Repeating issues

I have lines going like:
// TODO #10 #9 #8 #7 what is this
With the many issues there on github.

Git push fails fs.js:557

fs.js:557
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open 'C:\dev\tty'
at Object.fs.openSync (fs.js:557:18)
at Object.<anonymous> (C:\Users\USERNAME\AppData\Roaming\npm\node_modules\github-todos\node_modules\ttys\index.js:9:18)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\USERNAME\AppData\Roaming\npm\node_modules\github-todos\index.js:6:12)

Decouple from githooks?

First off, this looks really helpful. Unfortunately, hooks aren't ideal for the workflow that I follow (and for various organizational reasons, that workflow can't be changed). Would it be possible to expose the core library so that grunt or gulp tasks could be written around it?

plain export

I use vim-simple-todo to make checkboxes for my TODO's.
But the issues created par github-todos is shown as code, and therefore does not create Github-Flavored checkboxes. Is there a way to get github-todos to export plain issues? (I mean not in a code block.)

Thanks for your work.

EDIT:
what I get:

  [ ] task undone
  [X] task done

while I want/need:

  • task undone
  • task done

Target text file

Should be able to specify a simple TODO text file as provider. Using a well known format (SublimeText's PlainTasks? TodoTxt?) would be helpful.

Trying to get in touch regarding a security issue

Hi there,

I couldn't find a SECURITY.md in your repository and am not sure how to best contact you privately to disclose a security issue.

Can you add a SECURITY.md file with an e-mail to your repository, so that our system can send you the vulnerability details? GitHub suggests that a security policy is the best way to make sure security issues are responsibly disclosed.

Once you've done that, you should receive an e-mail within the next hour with more info.

Thanks! (cc @huntr-helper)

Failed injecting issues

Getting

Warning: failed injecting issues, you may need to do it manually in following files:
Error: Command failed: /bin/sh -c git commit -m '[Github-Todos] Inject issue numbers'

after pushing to github

XDG support/customization for global config file

First off, love this app, keep up the awesome work.

Secondly, what do you think about adding XDG support? The global config file would then be $XDG_CONFIG_HOME/github-todos/github-todos.cfg (or similar). The default (if $XDG_CONFIG_HOME is not set) would be ~/.config/github-todos/github-todos.cfg in addition to/instead of ~/.github-todos. Or let the user specify a custom location via an environment variable like GITHUB_TODOS_CONFIG or something.

Custom Host support

Looks like if you have a self hosted version of github It fails with the message

Connection to 'github' failed
Error: 'repo': expected format 'user/repository'

Error while tryping to `github-todos auth`

If I try to call
github-todos auth in my github repo i got

Connection to 'github' failed
Error: 'repo': expected format 'user/repository'

I presume, that this error because I try to use it on repo cloned via ssh. In my .git/config file lines are:
url = [email protected]:user/repo.git

Do not create issue - Throws error

I tried to ignore an issue. I selected n and the branch won't push.

my-app git:(master) git push origin master
? Create new issue "#3 throw an error - test" (src/app/my.service.ts:52) Do not create issue
[Github-Todos] Skipped - "#3 throw an error - test"
[Github-Todos] Injecting issue numbers to files…
TypeError: Cannot read property 'type' of null
error: failed to push some refs to '[email protected]:my-user/my-app.git'

If I select y the branch pushes up correctly.

my-app git:(master) git push origin master
? Create new issue "#3 throw an error - test" (src/app/my.service.ts:52)Create issue
[Github-Todos] Created issue #4 (#3 throw an error - test) - https://github.com/my-user/my-app/issues/4
[Github-Todos] Injecting issue numbers to files…
[Github-Todos] Added a commit containing issue injections
[Github-Todos] OK.
Counting objects: 9, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 819 bytes | 0 bytes/s, done.
Total 9 (delta 7), reused 0 (delta 0)
remote: Resolving deltas: 100% (7/7), completed with 6 local objects.
To github.com:my-user/my-app.git
   aaaaaaa..bbbbbbb  master -> master

Token is saved in .github-todos, which is not in .gitignore by default

The CLI says: Those information ARE NOT STORED, only the generated token will be stored in your global git configuration. (by which I assume it means e.g. ~/.gitconfig), but in my experience if you do:

github-todos config github.token <TOKEN>

then it ends up in .github-todos, not in the global config file. This makes it easy to accidentally checkin the token, which I believe one shouldn't do.

I like the idea of doing what the CLI says it'll do, but if it doesn't, it should probably instead say "make sure you add .github-todos to your .gitignore".

Support other issue managers

By @Palleas, asking to support Jira.

Goal

  • Add option issue-manager or manager or provider… set to "github" by default
  • Automatically detect the manager AND the repo in "github-todos init"
  • Load dedicated module instead of systematically "github"
  • Document how to include additional managers

Implementation

  • Reimplement "guessRepo()" (should delegate responsability to known managers if none set by user)
  • Reimplement public interface of "lib/github" for every new manager
    • Also implement the logic to guess repo (first point)
  • For Jira we can use node-jira

Things to check

  • Is described format for "repo" (user/repos) really important? I think it's just used in "github.js" and then we can make format simply dependent of issue manager (will need to output some clever documentation)

GitHub enterprise support

It looks like github.host is expected to be the full endpoint for the github api. Since we're on GitHub Enterprise, our API endpoint isn't at a domain root, it's a BASE_DOMAIN/api/v3. Is there a way to customize that path?

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.