Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Adds a general shape for discussions support #412

Merged
merged 14 commits into from
Aug 16, 2021
Merged

Adds a general shape for discussions support #412

merged 14 commits into from
Aug 16, 2021

Conversation

orta
Copy link
Contributor

@orta orta commented Jun 4, 2021

Adds a new function route for discussions on the DT repo.

Main features:

  • When you ask for help on a dt module then it requires you have [module-name] in the title somewhere, then it pings everyone and sets a label on the discussion for you. If you don't it asks you for info. If you don't it asks for it.

Some things that this means:

  • We will have categorized discussions which haven't been hooked up via a label
  • People can keep see overall what's going on with a dep via the labels
  • It doesn't rely on folks doing the work to find the right people to ping, which doesn't seem to happen too often

Future: When you post a new request for a dt module, it pings the discord

@orta orta marked this pull request as ready for review July 2, 2021 16:37
@orta
Copy link
Contributor Author

orta commented Jul 2, 2021

OK, I think this is pretty ready to go

@elibarzilay elibarzilay force-pushed the master branch 3 times, most recently from 1d39a68 to 9e931d1 Compare July 7, 2021 15:39
Copy link
Contributor

@elibarzilay elibarzilay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of mostly little things...

src/graphql-client.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Discussions-Trigger/sample.dat Outdated Show resolved Hide resolved
src/discussions-trigger.ts Outdated Show resolved Hide resolved
}
}

async function addLabel(discussion: Discussion, labelName: string, description?: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it upset GH if we end up with up to thousands of labels?

But more importantly, it looks like they're project-global, so having these massive number of labels is going to make dealing with labels pretty difficult. The least that this should do is use some prefix for these things, otherwise I can post a message with a [Critical] and confuse people and code...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've opted for "Pkg: " - I'd like something a bit further in the alphabet if you can thing of something better though? (emoji/non-ascii aren't counted in the sorting for labels)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see the Pkg: change, so leaving this open. Also: I'm still worried about the first point: we have thousands of packages, and therefore we'd end up with thousands of labels, and I'm not sure how things would look like if/when we have that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, over a long enough timeframe we could - I doubt the long-tail of DT modules worth writing a discussion about is that long though. To my knowledge (and some googling) there is no limit to the amount of issues a repo can have, and given they all have the same prefix - removing them from the repo is a pretty trivial script if it gets out of hand

src/discussions-trigger.ts Outdated Show resolved Hide resolved

const newLabel = await client.mutate(createMutation("createLabel" as any, { name: labelName, repositoryId: dtRepoID, color, description })) as any;
const newID = newLabel.data.label.id;
await client.mutate(createMutation<any>("addLabelsToLabelable" as any, { labelableId: discussion.node_id, labelIds: [newID] }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be pulled out of the if since it's the same in both sides.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(didn't see the change, so leaving open.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In now

src/discussions-trigger.ts Outdated Show resolved Hide resolved
src/discussions-trigger.ts Outdated Show resolved Hide resolved
@elibarzilay
Copy link
Contributor

I did some tweaks (main one is negating the result of the verify function), and marked all of the resolved comments as such.

I could do some of these too, but you said that you did them so I'm guessing that maybe you forgot to push some more changes, and if I'll fix these I'll create a conflict nightmare for you -- so left them as-is.

* `discussions-trigger`: added some uses of `txt` to make it more
  readable and other minor reformatting for the gql queries

* Call to `verifyIsFromGitHub` should be negated

* `verifyIsFromGitHub` doesn't need to be exported
@orta
Copy link
Contributor Author

orta commented Aug 16, 2021

Alright, I'm gonna nurse this deploy

@orta orta merged commit 9ed27cd into master Aug 16, 2021
@jakebailey jakebailey deleted the discussions branch May 15, 2024 02:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants