bitcrowd / tickety-tick

A browser extension that helps you name branches and write better commit messages
MIT License
57 stars 10 forks source link

Fix support for GitHub projects #403

Open klappradla opened 4 months ago

klappradla commented 4 months ago

GitHub's projetcts have changed a lot and our GitHub adapter currently does not work for them any more.

With project's v2 the most notable change is probably, that projects are an entity tied to the user/organization only, no longer to a specific repository. They may therefore contain issues from various repositories, plus special "draft" tickets which aren't linked to any issue in a repository yet.

An example for a project can be found at https://github.com/orgs/bitcrowd/projects/1

Regardless of whether viewing a "board" or a "list" view, users only see the full information about an issue when they click the title and the ticket is opened in the sidebar. This may be the only view which makes sense for Tickety-Tick to support. The HTML for it roughly looks like this:

<projects-v2>
  <div data-testid="issue-header">
    <h2>
      <bdi data-testid="issue-title">An Example Feature Ticket</bdi>
      <div>
        <a href="https://github.com/test/test/issues/2">#42</a>
      </div>
    </h2>
  </div>
  <div data-testid="issue-viewer-metadata-container">
    <h2 class="sr-only">Metadata</h2>
    <div data-testid="issue-labels">
      <a class="IssueLabel hx_IssueLabel" data-name="bug">bug</a>
      <a class="IssueLabel hx_IssueLabel" data-name="important">important</a>
    </div>
  </div>
</projects-v2>`

The data-testid attributes are unfortunately the only reliable contextual information it seems. Not sure how stable it is to rely on them.

This ticket is a follow up to #402 where we drop the broken support for GH projects.