Giter Club home page Giter Club logo

Comments (2)

fbartho avatar fbartho commented on June 8, 2024

@frantic1048 ā€” Iā€™m not sure DangerJS can fix this right? Since the upstream issue is 4 years old?ā€¦

What would you like to do here?

from danger-js.

frantic1048 avatar frantic1048 commented on June 8, 2024

@fbartho Here are 2 ways I found to workaround it, but both of them have their own drawbacks. I'm currently using the second workaround to perform checks around parent_ids.

  1. Use GitLab Commits API

    Retrieve parent_ids via GET /projects/:id/repository/commits/:sha, since this API is not suffering from the same issue. However, using this API may lead to lots of API calls when there are many commits in the merge request.

    e.g. https://gitlab.com/api/v4/projects/53011396/repository/commits/f1c6ae6e

  2. Use git CLI

    Use git show -s --pretty=format:%p <commit> to retrieve parent_ids. This more efficient than the first workaround, but it requires a local git repository.

    To ensure essential git history is available, we may need to run git fetch $CI_COMMIT_REF_NAME first.

    e.g. https://gitlab.com/frantic1048/danger-empty-parent-ids/-/blob/f1c6ae6e52db3a939c64c89f19227b16356da6ef/dangerfile.ts#L11-15

Because of the drawbacks, I'm not promoting any of the workarounds into danger-js. Just sharing my findings here in case anyone else is facing the same issue.

For danger-js, I think it's better to add some warning messages(through comments on the type definition) about parent_ids field in the merge request payload, so that users can be aware of the issue.

from danger-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.