question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: provider-agnostic API to fetch file contents of a different ref

See original GitHub issue

Describe the bug danger.github is undefined.

Cannot read property 'pr' of undefined
TypeError: Cannot read property 'pr' of undefined
    at dangerfile.js:5:62

To Reproduce

  • git clone https://github.com/edno/danger-github-undefined.git
  • cd danger-github-undefined
  • yarn install (Yarn 2)
  • git checkout new-branch
  • yarn danger local -b main

Expected behavior This should display

message(`:tada: The PR added ${additions} and removed ${deletions} lines.`)

Environment

software version
danger.js ^10.6.2
node v12.18.3
yarn 2.4.0
Operating System MacOS 11.2.1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ortacommented, Feb 14, 2021

Yep, good thinking, I’d accept a PR adding an API something like:

import {danger} from "danger"

 // could maybe be always "HEAD", but could also be a branch reference, hard to say what it should be with --staging though
danger.local.head
 
// master, or whatever someone changed it to
danger.local.base 

// New to .git - when in `local` use wrapped git call, otherwise use the available APIs 
// Defaults to the head version
danger.git.getFileContents("file.md")

// So, you can get the other SHA refs
danger.git.getFileContents("file.md", danger.local.base)
1reaction
ortacommented, Feb 14, 2021

I don’t think there’s an API for that today, I have generally only looked at the files which changed and not necessarily the contents - I think there could be a danger.local API which feels like github which wraps calls to git to provide those sorts of functions?

Read more comments on GitHub >

github_iconTop Results From Across the Web

HashiCorp Certified Terraform Associate Learning Path
Terraform Associate Certification learning path covers summary, key topics and resources useful for preparing for the exam.
Read more >
CAPI classes in MID Server script includes
Cloud Provisioning and Governance provides several JavaScript classes that make REST calls to cloud providers. These classes are called from MID Server ...
Read more >
Provider agnostic authentication and authorization in ...
Static token file: the API server reads bearer tokens from a file when provided with the --token-auth-file=tokenfile flag in the command line.
Read more >
Sample CI configurations - Semgrep
View sample configuration files to run Semgrep with various CI/CD providers such as GitHub, ... CI provider agnostic; feature support is dependent on...
Read more >
What's New in EF Core 7.0 - Microsoft Learn
EF7 contains provider-agnostic support for JSON columns, with an implementation for SQL Server. This support allows mapping of aggregates built ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found