elastic / snyk-github-issue-creator

CLI tool for creating GitHub issues from Snyk project issues
5 stars 6 forks source link

Fixes 'ensureLabelsAreCreated' by paginating API results #26

Closed jeramysoucy closed 10 months ago

jeramysoucy commented 10 months ago

We have > 100 labels in the security repo, and we were not paginating the call to retrieve them. Previously, this was working because the labels we wanted to apply to an issue (typically Kibana, snyk, and triage_needed) were within the first 100 results, but as new labels were created, some of the labels are now in the second page of results (specifically "triage_needed"). This caused ensureLabelsAreCreated to throw when attempting to create an existing label.

This PR adds pagination of the listLabelsForRepo API call.

Additionally, this PR replaces the deprecated snyk List all projects v1 API with the newer REST API. The v1 API EOL is December 22, 2023. See the official statement for more information.