Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GitHub module repositories setting optional #1312

Open
pcrockett opened this issue Aug 18, 2022 · 6 comments
Open

Make GitHub module repositories setting optional #1312

pcrockett opened this issue Aug 18, 2022 · 6 comments
Labels
💪 improvement "Where we're going, we don't need roads." wontfix

Comments

@pcrockett
Copy link

What should it do?

I have access to a lot of repositories, and I want to use my dashboard to display all relevant GitHub information. I want a list of open pull requests, issues, etc. for any of my dozens of repositories.

I got this working with the customQueries setting. I use filter to control what I see in my dashboard rather than specifying a huge list of repos. So that means I really don't need the repositories setting at all.

I tried excluding the repositories setting from my config, however that causes wtfutil to crash:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0xcd7056]

goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1()
        /Users/chris/go/pkg/mod/github.com/rivo/tview@v0.0.0-20200108161608-1316ea7a4b35/application.go:149 +0x4d
panic({0x18b08e0, 0x302e4c0})
        /opt/homebrew/opt/go/libexec/src/runtime/panic.go:1038 +0x215
github.com/wtfutil/wtf/modules/github.(*Repo).myReviewRequests(0xc00011b8c0, {0xc0006a1da0, 0x9})
        /Users/chris/Projects/wtf/modules/github/github_repo.go:176 +0x36
github.com/wtfutil/wtf/modules/github.(*Widget).content(0xc000020900)
        /Users/chris/Projects/wtf/modules/github/display.go:26 +0x17d
github.com/wtfutil/wtf/view.(*TextWidget).Redraw.func1()
        /Users/chris/Projects/wtf/view/text_widget.go:49 +0x2a
github.com/rivo/tview.(*Application).QueueUpdateDraw.func1()
        /Users/chris/go/pkg/mod/github.com/rivo/tview@v0.0.0-20200108161608-1316ea7a4b35/application.go:493 +0x26
github.com/rivo/tview.(*Application).Run(0xc00079f500)
        /Users/chris/go/pkg/mod/github.com/rivo/tview@v0.0.0-20200108161608-1316ea7a4b35/application.go:253 +0x5e8
github.com/wtfutil/wtf/app.(*WtfApp).Run(0xc00084ff08)
        /Users/chris/Projects/wtf/app/wtf_app.go:80 +0x2e
main.main()
        /Users/chris/Projects/wtf/main.go:64 +0x42a

As a workaround, I added a single repository that I don't care about to my repositories list, and everything works correctly... except that repository name shows up in my dashboard title. Which is not terribly ideal.

Is there a reason we need to specify a list of repos? Can we make it optional?

@pcrockett
Copy link
Author

pcrockett commented Aug 18, 2022

Here's the relevant portion of my config that shows what I'm doing:

    github:
      # apiKey: "Use WTF_GITHUB_TOKEN env variable instead"
      title: "GitHub"
      showStats: false
      showMyPullRequests: false
      showOpenReviewRequests: false
      customQueries:
        myPRs:
          title: "My PRs"
          filter: "is:open is:pr author:pcrockett archived:false user:my-org"
        assignedPRs:
          title: "Assigned PRs"
          filter: "is:open is:pr archived:false user:my-org assignee:pcrockett"
        reviewRequests:
          title: "Review Requests"
          filter: "is:open is:pr archived:false user:my-org review-requested:pcrockett"
      enabled: true
      enableStatus: true
      repositories:
        - "pcrockett/some-private-repo-i-dont-care-about"
      position:
        top: 3
        left: 2
        height: 1
        width: 1
      refreshInterval: 5m
      username: "pcrockett"

@senorprogrammer
Copy link
Collaborator

Yep, should be possible to create it so that ‘repositories’ is optional.

@Seanstoppable
Copy link
Collaborator

Definately an interesting idea.
There is some refactoring work we'd have to do, because the github client is actually initialized within a repo object.
I'm going to start by decomposing that first, which should make only custom queries a bit easier.

@senorprogrammer senorprogrammer added the 💪 improvement "Where we're going, we don't need roads." label Aug 28, 2022
@stale
Copy link

stale bot commented Feb 24, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 24, 2023
@Seanstoppable
Copy link
Collaborator

I wonder if the best thing would be to just write a new module for a number of these modules which take ad-hoc queries
They were originally written in a less flexible way, and it is probably faster to write a new module for advanced users than trying to force backwards compatibility.

@stale stale bot removed the wontfix label Feb 24, 2023
@stale
Copy link

stale bot commented Aug 23, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 improvement "Where we're going, we don't need roads." wontfix
Development

No branches or pull requests

3 participants