mediumroast / mediumroast_js

Mediumroast for GitHub CLI and API/SDK
https://www.mediumroast.io/product.html
Apache License 2.0
1 stars 0 forks source link

Enable reports packaging #109

Closed miha42-github closed 2 months ago

miha42-github commented 2 months ago

Introduction

mrcli includes a --package option when creating a report that is presently not working. The old implementation assumed that S3 was the backing store. The new model has GitHub as the backing store. This issue is meant to change that behavior to convert from S3 to GitHub.

Potential steps

Thinking

Implementation progress

Change download code from S3 to GitHub

Using axis the conversion was relatively simple to enable downloading of content. The shift to axis now downloads an Interaction to the working directory in the .mediumroast/ folder.

Enable packaging for Interactions

While an Interaction's report with the --package flag currently can download the Interaction's content getting the report to completely run given the change to how Companies data is structured/pulled needs to be sorted. The current effort likely needs to do the following:

miha42-github commented 2 months ago

Packaging for interactions is now operable in the development branch. The behavior is to get the interaction object, download the content into a working directory, create a ZIP package in DOCUMENTS, and then cleanup all of the working directory data. The CLI is now verified to work both with and without the --package switch when a report is generated.

miha42-github commented 2 months ago

Encountered what appears to be a bug in GitHub and have opened an issue to understand more, essentially the download URL isn't properly encoded so axios cannot GET the file. The issue is The GitHub API fails to properly encode a URL for download #2962411.

Will attempt to write a workaround that only tries the download should the URL be encoded,

miha42-github commented 2 months ago

Found a workaround that looks to see if the download URL is encoded and if not it will replace it with an encoded version. One discovery is that if the file has a ? in the name special treatment should be taken as the ? is usually a signal of query parameters being added to the URL. The workaround has been shown to work with one company so far. On a more general basis, testing will occur with additional companies and interactions.

miha42-github commented 2 months ago

The packager now works for companies and interactions with a clear workaround for downloads. Testing will occur as documentation work is processed.