Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug][Github] Extractor failing with draft release #8148

Closed
2 of 3 tasks
karl-d opened this issue Oct 17, 2024 · 2 comments · Fixed by #8214
Closed
2 of 3 tasks

[Bug][Github] Extractor failing with draft release #8148

karl-d opened this issue Oct 17, 2024 · 2 comments · Fixed by #8214
Labels
component/plugins This issue or PR relates to plugins severity/p1 This bug affects functionality or significantly affect ux type/bug This issue is a bug

Comments

@karl-d
Copy link

karl-d commented Oct 17, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

When running the pipeline against a github repo that contains a draft release it fails due to not having a incorrect datetime value for the published at column

image

What do you expect to happen

I would expect this to ignore the draft release.

How to reproduce

Create a draft PR in a repository, run the Collect Data and see the error on the github_graphql stage.

Anything else

We have this occur across a number of our projects where we use a GitHub Action to automatically draft a new PR for the next release.

Version

v1.0.1

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@karl-d karl-d added the type/bug This issue is a bug label Oct 17, 2024
Copy link

dosubot bot commented Oct 17, 2024

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!

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:

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 [1].

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added component/plugins This issue or PR relates to plugins severity/p1 This bug affects functionality or significantly affect ux labels Oct 17, 2024
J0shSkqlq added a commit to J0shSkqlq/incubator-devlake that referenced this issue Nov 22, 2024
Draft releases lead to a bug described in GH Issue apache#8148
J0shSkqlq added a commit to J0shSkqlq/incubator-devlake that referenced this issue Nov 26, 2024
Draft releases lead to a bug described in GH Issue apache#8148
klesh pushed a commit that referenced this issue Nov 27, 2024
Draft releases lead to a bug described in GH Issue #8148
J0shSkqlq added a commit to J0shSkqlq/incubator-devlake that referenced this issue Nov 27, 2024
Draft releases lead to a bug described in GH Issue apache#8148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/plugins This issue or PR relates to plugins severity/p1 This bug affects functionality or significantly affect ux type/bug This issue is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants