dosubot[bot] commented on issue #8148:
URL:
https://github.com/apache/incubator-devlake/issues/8148#issuecomment-2420374827
<!-- Greeting -->
Hey @karl-d! I'm here to help you with any bugs, questions, or contributions
you have for the project. I'll be your friendly bot while you wait for a human
maintainer. Let's tackle this together!
<!-- Answer -->
To address the issue with the GitHub extractor failing due to draft
releases, you can modify the `ExtractReleases` function to ignore draft
releases and handle invalid dates in the `published_at` column. Here's how you
can update the code:
```go
Extract: func(row *api.RawData) ([]interface{}, errors.Error) {
release := &GraphqlQueryRelease{}
err := errors.Convert(json.Unmarshal(row.Data, release))
if err != nil {
return nil, err
}
// Skip draft releases
if release.IsDraft {
return nil, nil
}
// Check for invalid 'PublishedAt' date
if release.PublishedAt == "0000-00-00" {
release.PublishedAt = nil // or set to a default valid date if
necessary
}
var results []interface{}
githubRelease, err := convertGitHubRelease(release,
data.Options.ConnectionId, data.Options.GithubId)
if err != nil {
return nil, errors.Convert(err)
}
results = append(results, githubRelease)
return results, nil
},
```
This modification ensures that draft releases are ignored and any invalid
'PublishedAt' dates are handled appropriately
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/github_graphql/tasks/release_extractor.go)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]