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

JSON metadata export #173

Closed
pngwn opened this issue Aug 15, 2024 · 0 comments · Fixed by #183
Closed

JSON metadata export #173

pngwn opened this issue Aug 15, 2024 · 0 comments · Fixed by #183

Comments

@pngwn
Copy link

pngwn commented Aug 15, 2024

Thanks for this library + service! It is wonderful!

Goal

On gradio we publish a large number of packages and the comment is very noisy, even with the current accordion implementation. We also have a number of other comments that are generated as part of our CI process.

It would be great if we could could have some more control over the the comment created.

Proposed solution

While it may be possible to make the comment configurable, i think this will probably just result in a seemingly infinite loop of tweaks and options.

I think the best solution would be to export some metadata for the previews, so that users can do what they want with it. I think it is unreasonable to print this to stdout via the CLI due to the long length of the data, saving it to a json file seems most appropriate.

I think this would be great:

pnpx pkg-pr-new publish --json

This would save the meatadata to a json file (pkg-pr-new.json or something)

We could also allow users to set the file path:

pnpx pkg-pr-new publish --json=path/file.json

Metadata structure

For forwards compatibility reasons, i think it would make sense to have a json object with a publishedPackages key, rather than a plain json array.

The packages themselves only need to list the name and the two preview links that are generated (i think pkg.pr.new generates both a PR suffix and a sha shorthash prefix version of the urls?). So something like this:

interface Package {
  name: string;
  sha_url: string;
  pr_url: string;
  template: string
}

interface Metadata {
  workflow_url: string; // url to the pkg.pr.new. workflow
  publishedPackages: Package[]

  // we could add additional metadata if needed
  // such as the commit sha, pr number, repo, etc
}

I like this approach because it should work well with some of the other proposed changes, would only tell you about new publishes (rather than the contents of your workspace), and should be flexible enough so that more information could be added in the future. It also gives the user plenty of flexibility without placing a huge maintenance burden on this library.

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 a pull request may close this issue.

1 participant