Collect package data from specific tags #260
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requirements
Filling out the template is required.
All new code requires tests to ensure against regressions.
Have you ran tests against this code?
This PR contains zero code changes.
Description of the Change
This PR enables the collection of package details via a specific
ref
. This means that the backend now supports mono-repos or in the case of #205 supports non-standard repositories such as those mirroring other forges.The functionality differs slightly between:
Initial Publication
After verifying the repository exists, the backend first requests the available tags on GitHub. After collecting them then the data needed for the package (
README.md
,package.json
) are collected according to each available tag we found earlier. This also has the benefit of resolving a long standing issue where when retroactively publishing other versions on initial publication the data shown for these previous versions was technically incorrect as it'd only show whatever was the latest data.Publishing a Version
When we publish a new version we take the
ref
provided within the request. (Which has always been present, but actually the backend has been ignoring and not even collecting this value so far in operation)This
ref
is then what's used to collect further details.During these changes I ended up scraping many of the VCS 'unit' tests, as they were so closely coupled to actual logic and mocks it became unwieldy to rewrite as needed, and instead was easier to rewrite them as full integration tests with
nock
. With that I was able to discover some new issues, such as the documented return of the version publication endpoint being inaccurate, I discovered that during version publication we didn't ever verify the repository existed first, and finally found that if the version publication failed, the resulting webhook attempt to Discord could cause bigger failures than we'd hope. So of course this PR has also fixed all those above issues.Fixes #205
Fixes #255