nikku / wuffle

A multi-repository / multi-organization task board for GitHub issues.
https://wuffle.dev
MIT License
118 stars 23 forks source link

Add Status to Pull Requests #40

Closed joannenolan-sky closed 5 years ago

joannenolan-sky commented 5 years ago

Screen Shot 2019-07-12 at 09 56 57 As per the screenshot , we would like to see the status of a PR . This will enable us to quickly see if a PR has failed its tests.

To get this information we need to subscribe to status events. This will give us the status information for a sha of a branch.

To enable this in Wuffle we need the following fields:

We can then track the status of a sha and the context states in the following format

    "3aeaa5b41d94184dc54a0247059df8539aec2929": {
      "JOANNE_NOLAN_SKY-SCRIPTS-_TRIGGER": {
        "target_url": "https://jenkisn/test1",
        "state": "success"
      },
      "RESOURCES": {
        "target_url": "https://jenkisn/test2",
        "state": "success"
      }
    }

A status event occurs whenever a branch is pushed, so it can occur before a Pull request is raised. This means we need to store it separately from an issues, similar to links.

There is also some work to get the status if when the background sync is occurring. This returns the combined status so the fields we will need are:

nikku commented 5 years ago

I've created https://github.com/nikku/wuffle/issues/41 to track the integration of checks and statuses onto PR cards.

nikku commented 5 years ago

Hi @joannenolan-sky, sorry for not getting back to you for on this one earlier.

The just released version v0.23.0 of the board lays the foundation for implementing this feature outside the core. Specifically, I added two things:

A blueprint for such an extension is review support, implemented via https://github.com/nikku/wuffle/commit/eff80ed319016d62d9ba20ca0f56d962b4bfa912.

Looking into your PR I see that you create additional APIs and stores to keep status related information. This has a couple of issues, mainly increased complexity and need for manual cleanup.

Taking the reviews approach into account, you could do the following:

Would you still like to see this feature in the core?

joannenolan-sky commented 5 years ago

I will look into the changes you have suggested and see if it will work for what I need. I still think it would be useful to have in core though as we have been using the status bar for the last few months and it has been extremely useful, so much so we now depend on it

nikku commented 5 years ago

I still think it would be useful to have in core though.

It will be part of the project but separated into its own component. So in a way, it be part of the core, of course.

nikku commented 5 years ago

You may hook into issue updates in the store via the following:

events.on('store.issueUpdated', event => {
  const { existingIssue, update, updatedIssue } = event;

  // check whether it is a PR and the sha changed, if that is the case, 
  // fetch the status and update it later on via

  store.updateIssue({ id: issue.id, status: fetchedStatus });
});
nikku commented 5 years ago

I've added the checks and status display UI via #53:

screely-1570796194331

So this is something you can drop from your PR and reuse what's there instead.

joannenolan-sky commented 5 years ago

@nikku cool, I will rework my PR

nikku commented 5 years ago

Went ahead and implemented it myself, cf. https://github.com/nikku/wuffle/pull/64.

Closing this PR in favor of https://github.com/nikku/wuffle/pull/64.