-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add Linear.app adapter #336
Conversation
Note that we could also use Linear's SDK to fetch ticket info, but I gave it a try and it felt slow, so I think it's worth the tradeoff of using selectors even if might need updating from time to time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mtarnovan 👋
Thanks a ton for your interest in this project and for jumping on board with a contribution 💚
I'm a bit hesitant about integrating this adapter though: I've never heard of the tracker software and we're not using it internally. This combined with the fact that the adapter's implementation is - as you said - very fragile and likely to break on any updates the team does to their software (imagine for instance they switch from <span>
with title
attribute to normal <label>
and <input>
tags), makes it quite hard to maintain for us.
And having an adapter which is very likely to break fully unnoticed is a bit of a pain to maintain for us.
I'll think about it again and hopefully have the time some day this week to also try it with the software.
Thanks a ton 💙
expect(result).toEqual([]); | ||
}); | ||
|
||
it("extracts the ticket from the issue page", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there also other views where one would highlight a ticket? E.g. a sprint or list view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are such views, but since the markup is so obfuscated I'm not sure it's worth the effort...
|
||
if (!id) return []; | ||
|
||
const ticket = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there also a description
field in a somewhat commit-message-body-usable format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use the API (see my other comment) then yes, otherwise, probably not very reliably.
src/core/search.ts
Outdated
GitHub, | ||
GitLab, | ||
Jira, | ||
Notion, | ||
Tara, | ||
Trello, | ||
Linear, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stick with alphabetic ordering 🤷 Even though it's not "fair".
if (url.hostname !== "linear.app") return []; | ||
|
||
const { id, issueType } = match("/:team/:issueType/:id/:slug", url.pathname); | ||
const title = $text('[title="Edit issue title"]', document); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is indeed a bit fragile 🧱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The markup looks like this:
So I don't see a way around this other that the one I already mentioned: use the official SDK which is a client for a Graphql API (but as I said I played around with it seems a bit slow, I don't want to wait seconds to grab a branch command 🙃). Ofc using an API client would be much more reliable and maintainable, so if that's your preference I could explore that alternative.
Hey @klappradla, Thanks for taking the time to review.
We switched from JIRA to Linear and so far we like it (although it is missing some more advanced features)
Understood. I can work on an alternative implementation using the official SDK then, it should be more reliable (albeit slower...). Best, |
Hey @mtarnovan 👋 I thought about this PR again over the holiday. It would indeed be great if TicketyTick would support a more diverse set of trackers, even tools which bitcrowd isn't using internally. If you and your team are actively using the tool, we can be sure that breaking changes on the So my suggestion would be: do a quick spike on a) trying to get the ticket's Another note on fetching via the API: take a look at the |
Hey Max 👋
We are probably going to stick with Linear for the foreseeable future, so yes, we can be the canary in the coal mine :-)
Happy to give that a try when time permits.
From my research Linear uses the same GraphQL API internally and externally (they provide an SDK that wraps it). They provide a global function I'll try what you're suggesting, but I'm pretty sure it will not work: their internal APIs are authenticated with Oauth bearer tokens, not with session cookies (like I assume notion.so does). To summarize:
Thanks again, |
5f74a62
to
52024bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates @mtarnovan 🙏
If this has been working for you with a local build in the last weeks, let's give this a try for everyone 🌊 ⛵
@klappradla nice! Please ping me when you release this to the extension stores so I can replace the locally build extension. I'll keep an eye on breakages and will try to fix them asap. |
Adds a simple, DOM based Linear adapter.
The selectors are fragile (because Linear minimizes their CSS so we can't use their CSS classes) and will require updating if Linear adds more languages.
I had a few issues locally:
dist/
the path is picked up byyarn test
which produces a lot of confusing test failuresterminal-notifier
. Those will crash on arm64 (Apple M1). Sinceterminal-notifier
seems unmaintained, as a (very) dirty work-around one can compileterminal-notifier
to get an arm64 executable (for example viabrew
) and use that binary instead:In lieu of a better fix, maybe we should add this to the README?