gruntwork-io / fetch

Download files, folders, and release assets from a specific git commit, branch, or tag of public and private GitHub repos.
https://www.gruntwork.io/
MIT License
587 stars 90 forks source link

Skip tags that are not Semantically Versioned #77

Closed pete0emerson closed 3 years ago

pete0emerson commented 3 years ago

This closes #75

I validated each tag, discarding any that aren't SemVer.

For testing, I suggest that a non-SemVer tag be added to the public and private test repositories github_test.go.

https://github.com/gruntwork-io/fetch/blob/4bec67f9ab28423e6b6f72b2fc9d397e5681c671/github_test.go#L25-L28

pete0emerson commented 3 years ago

Could you add an automated test to validate this behavior?

I've added expectedNumTags and set it to 3 for https://github.com/gruntwork-io/fetch-test-public and 1 for https://github.com/gruntwork-io/fetch-test-private (for which I don't have access, so I can't verify that 1 is correct, but I think it is since firstReleaseTag and lastReleaseTag are both set to v0.0.2).

To fully be confident this is always working, I'd suggest adding a couple of non-SemVer tags to both of those repositories; the expectedNumTags values I've set shouldn't change, but having a "bad" tag in there will then hit the code that skips those tags.

brikis98 commented 3 years ago

I've added expectedNumTags and set it to 3 for https://github.com/gruntwork-io/fetch-test-public and 1 for https://github.com/gruntwork-io/fetch-test-private (for which I don't have access, so I can't verify that 1 is correct, but I think it is since firstReleaseTag and lastReleaseTag are both set to v0.0.2).

To fully be confident this is always working, I'd suggest adding a couple of non-SemVer tags to both of those repositories; the expectedNumTags values I've set shouldn't change, but having a "bad" tag in there will then hit the code that skips those tags.

Nice, thanks!

I added a non-semantic tag to both repos that looks like this: https://github.com/gruntwork-io/fetch-test-public/releases/tag/non-semantic

pete0emerson commented 3 years ago

Done, and my local tests are passing until I hit the private repos.

brikis98 commented 3 years ago

Tests passed! Merging now.

brikis98 commented 3 years ago

https://github.com/gruntwork-io/fetch/releases/tag/v0.3.11