Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi.

I did a small test, and it worked fine on gitlab.com, but after running on our self-hosted gitlab encountered a problem:

$ echo "dangerfile:" $DANGERFILE
dangerfile: ./dangerfile.ts
$ yarn danger ci --dangerfile=$DANGERFILE -f
yarn run v1.22.19
$ /builds/Services/rnc/node_modules/.bin/danger ci --dangerfile=./dangerfile.ts -f
(node:187) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Found only warnings, not failing the build.
Error:  undefined
error Command failed with exit code 1.

dangerfile:

import {danger, message, warn} from 'danger';

if (danger.git.modified_files.includes('lang/en.json')) {
  if (!danger.git.modified_files.includes('lang/de.json')) {
    warn('This PR changes translation files, do not forget to run translation script');
  } else {
    message('Translation files seem synced');
  }
}

.gitlab-ci.yml fragment:

## Run danger checks
danger:
  stage: test
  allow_failure: true
  image: node:latest
  before_script:
    - yarn install:ci
  variables:
    DANGERFILE: './dangerfile.ts'
  script:
    - echo "dangerfile:" $DANGERFILE
    - yarn danger ci --dangerfile=$DANGERFILE -f
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
  <<: *yarn_cache

Also env var DANGER_GITLAB_API_TOKEN with a token was created.

Where do I start debugging?

You must be logged in to vote

Ok, looks like it was a token permission level issue.

Resolved after adding these scopes:

api
read_api
read_user
read_repository

Replies: 1 comment · 2 replies

Comment options

Ok, looks like it was a token permission level issue.

Resolved after adding these scopes:

api
read_api
read_user
read_repository
You must be logged in to vote
2 replies
@dimsuz
Comment options

Thank you for finding this! I was puzzled by this message.

I would consider it a bug, danger really should've included the reason for why it failed.

@orta
Comment options

orta Nov 4, 2023
Maintainer

Agree, you're welcome to take a look at adding it 👍🏻

Answer selected by beshur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.