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

feat: add --only-templates flag #172

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

sadeghbarati
Copy link
Contributor

For instance, check this PR in TanStack, TanStack/query#7861

The problem is when repository has too many packages the amount of scroll on the PR page will increase, adding another detail to the pkg.pr.new links conditional with a flag like --collapsed-links will help resolve this case

packages/cli/index.ts Outdated Show resolved Hide resolved
@Aslemammad
Copy link
Member

Can we have onlyTemplates option that only shows the user defined options? Since that's what Seb suggested.

instead of the --collapsedLinks option.

@slorber
Copy link

slorber commented Aug 15, 2024

What I'd like is something like this:

This PR has been continuously released. You can run its code in one of our templates:

Alternatively you can try the PR code directly into your project:

Dependencies

npm add https://pkg.pr.new/@docusaurus/core@7861
npm add https://pkg.pr.new/@docusaurus/utils@7861
npm add https://pkg.pr.new/@docusaurus/theme-common@7861


Maybe you can consider the comment has 2 sections.

And let me activate sections and order them? For example --section templates --section dependencies

And let me pass a custom section intro message for both.


Full example CLI options:

--section templates
--templates-intro 'This PR has been continuously released. You can run its code in one of our templates:'
--section dependencies
--dependencies-intro 'Alternatively you can try the PR code directly into your project:'

@Aslemammad
Copy link
Member

@slorber For now, let's only show the templates for the option --onlyTemplates

For further customization, as #173 suggested, we'd have a json output that would allow maintainers have more control over the output!

wdyt?

@sadeghbarati sadeghbarati changed the title feat: collapse pkg.pr.new packages links feat: add --only-templates flag Aug 15, 2024
@slorber
Copy link

slorber commented Aug 16, 2024

Fine with a simple option 👍

@Aslemammad Aslemammad merged commit 9c74c2d into stackblitz-labs:main Aug 19, 2024
2 of 4 checks passed
@slorber
Copy link

slorber commented Aug 19, 2024

let me know once it's on npm

By the way what's the final comment with this new option?

Is the comment template part of this repo? I may want to fork it and customize for our own needs eventually.

@Aslemammad
Copy link
Member

let me know once it's on npm

For sure

By the way what's the final comment with this new option?
Is the comment template part of this repo? I may want to fork it and customize for our own needs eventually.

Hmm, could you give me more context? Thank you so much❤️

@sadeghbarati sadeghbarati deleted the collapsed-links branch August 20, 2024 04:05
@slorber
Copy link

slorber commented Aug 20, 2024

Hmm, could you give me more context?

Hmmm not sure what to add: we agreed to keep this option simple and not have the ability to provide custom labels like my former suggestion. Can I implement custom labels myself by forking/patching this package, or is the final message being created/posted by some StackBlitz internal backend?

@Aslemammad
Copy link
Member

Can I implement custom labels myself by forking/patching this package, or is the final message being created/posted by some StackBlitz internal backend?

Oh yea, with the #183, now you can turn comments off, get the json output and then create your own message! 😄

We will release soon.

@slorber
Copy link

slorber commented Aug 21, 2024

@Aslemammad that probably works but looks more complicated, do you have a full github action example flow doing so?

As far as I remember it's a bit annoying in terms of security to have your action post a GitHub comment and build the code.

@Aslemammad
Copy link
Member

As far as I remember it's a bit annoying in terms of security to have your action post a GitHub comment and build the code.

Yea, haven't looked into that, but for sure, it might have its own trade offs. But I guess that's only way we can make it extensible and let others custmize on top of it, without building many abstractions in code, which is a bit challenging.

@pngwn might want to share thoughts on this?

@pngwn
Copy link

pngwn commented Aug 21, 2024

Yes we do this a lot over on gradio. It is indeed a little more annoying but relatively straightforward.

I'll post an example flow shortly.

@pngwn
Copy link

pngwn commented Aug 21, 2024

Fwiw I do think the JSON approach is preferable to additional formatting params. This allow the most flexibility, and can even allow you to add the info to an existing CI reply rather than every service generating additional replies (which also gets very noisy).

@slorber
Copy link

slorber commented Aug 23, 2024

Yes JSON is flexible, now if you tell me how to wire it in my CI properly and I just have to copy/paste the complex actions files, that works for me 😄

@pngwn
Copy link

pngwn commented Aug 23, 2024

Just waiting for a release and I'll post it (the old pr link is dead now). Has this been released?

@pngwn
Copy link

pngwn commented Aug 23, 2024

I'll also make a PR to the docs / readme when it is out.

@Aslemammad
Copy link
Member

Aslemammad commented Aug 23, 2024 via email

@pngwn
Copy link

pngwn commented Aug 23, 2024

No worries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants