Closed Sega-Zero closed 6 years ago
Can you try run with DEBUG="*" danger process danger-swift
and see what the JSON is passed into Danger Swift looks like, valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "danger", intValue: nil), CodingKeys(stringValue: "github", intValue: nil), CodingKeys(stringValue: "pr", intValue: nil), CodingKeys(stringValue: "head", intValue: nil), CodingKeys(stringValue: "repo", intValue: nil), CodingKeys(stringValue: "description", intValue: nil)], debugDescription: "Expected String value but found null instead.", underlyingError: nil))
is the true error, which is a bit worrying
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Accept: application/vnd.github.v3.diff" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16 +0ms
danger:GitHubAPI getPullRequestCommits:: Sending pull request commit request for first page +0ms
danger:GitHubAPI getPullRequestCommits:: Request url generated "repos/org/Project/pulls/16/commits" +1ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/commits +828ms
danger:GitHubAPI getNextPageFromLinkHeader:: Given response does not contain link header for pagination +504ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16 +510ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/issues/16 +545ms
danger:GitHubAPI getPullRequestCommits:: Sending pull request commit request for first page +1s
danger:GitHubAPI getPullRequestCommits:: Request url generated "repos/org/Project/pulls/16/commits" +0ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/commits +479ms
danger:GitHubAPI getNextPageFromLinkHeader:: Given response does not contain link header for pagination +483ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Accept: application/vnd.github.black-cat-preview+json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/reviews +484ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Accept: application/vnd.github.black-cat-preview+json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/requested_reviewers +477ms
danger:runDangerSubprocess Running subprocess: danger-swift - +0ms
Executing pwd
Working directory: /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project
Ran with: Dangerfile.swift /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-dsl.json /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-response.json
ERROR: Failed to parse JSON: valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "danger", intValue: nil), CodingKeys(stringValue: "github", intValue: nil), CodingKeys(stringValue: "pr", intValue: nil), CodingKeys(stringValue: "head", intValue: nil), CodingKeys(stringValue: "repo", intValue: nil), CodingKeys(stringValue: "description", intValue: nil)], debugDescription: "Expected String value but found null instead.", underlyingError: nil))
$ cd "/Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/.build/" && ln -s "/Users/speek/.danger-swift/Packages/Generated/.build/checkouts/" "checkouts"
$ cd "/Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/.build/" && ln -s "/Users/speek/.danger-swift/Packages/Generated/.build/repositories/" "repositories"
$ cd "/Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/.build/" && ln -s "/Users/speek/.danger-swift/Packages/Generated/.build/dependencies-state.json" "dependencies-state.json"
$ cd "/Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/" && ln -s "/Users/speek/.danger-swift/Packages/Generated/Package.resolved" "Package.resolved"
$ cd "/Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/" && ln -s "/private/var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project/_dangerfile_imports.swift" "OriginalFile"
$ cd "/Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/" && readlink OriginalFile
/private/var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project/_dangerfile_imports.swift
$ cd "/private/var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project/" && /usr/bin/env xcrun --sdk macosx swift package --version
Apple Swift Package Manager - Swift 4.1.0 (swiftpm-14050)
$ cd "/Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/" && /usr/bin/env xcrun --sdk macosx swift build -C /Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/
Compile Swift Module 'Files' (1 sources)
Compile Swift Module 'Danger' (9 sources)
Linking ./.build/x86_64-apple-macosx10.10/debug/libDanger.dylib
Compile Swift Module 'DangerSwiftLint' (3 sources)
Compile Swift Module '_dangerfile_imports' (1 sources)
Linking ./.build/x86_64-apple-macosx10.10/debug/_dangerfile_imports
Linking ./.build/x86_64-apple-macosx10.10/debug/libMarathonDependencies.dylib
Running: /usr/bin/swiftc --driver-mode=swift -L /usr/local/lib/danger -I /usr/local/lib/danger -lDanger -L /usr/local/lib/danger -I /usr/local/lib/danger -L /Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/.build/debug -I /Users/speek/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/.build/debug -lMarathonDependencies Dangerfile.swift /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-dsl.json /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-response.json
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-response.json
danger:runDangerSubprocess child process exited with code 1 +9s
danger:runDangerSubprocess Handling fail from subprocess +0ms
Error: TypeError: Cannot read property 'concat' of undefined
at Object.exports.mergeResults (/usr/local/lib/node_modules/danger/distribution/commands/utils/reporting.js:15:32)
at Object.<anonymous> (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:99:51)
at step (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:32:23)
at Object.next (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:13:53)
at /usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:7:71
at __awaiter (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:3:12)
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:87:48)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
I have a DangerFile.swift
in repo's root, is it case sensitive?
curl -i -X GET -H "Content-Type: application/json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/commits
returns
HTTP/1.1 404 Not Found
Server: GitHub.com
Date: Sat, 05 May 2018 15:49:01 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 87
Status: 404 Not Found
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 55
X-RateLimit-Reset: 1525537227
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-Runtime-rack: 0.012225
X-GitHub-Request-Id: DE4A:4AFC:1E360CF:44B10FB:5AEDD26D
{
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3"
}
Looks to me like your auth token doesn't have access to that repo
I've created this token on my account having full access to that repo.
curl -I -H 'Authorization: token [API TOKEN]' https://api.github.com/users/%user%
HTTP/1.1 200 OK
Server: GitHub.com
Date: Sun, 06 May 2018 16:06:00 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 1579
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4274
X-RateLimit-Reset: 1525622998
Cache-Control: private, max-age=60, s-maxage=60
Vary: Accept, Authorization, Cookie, X-GitHub-OTP
ETag: "edc673dd91acb9e2dd863f30a9d0a192"
Last-Modified: Sat, 05 May 2018 14:31:44 GMT
X-OAuth-Scopes: notifications, repo, user
X-Accepted-OAuth-Scopes:
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-Runtime-rack: 0.058138
X-GitHub-Request-Id: 4EBB:4AFD:33E6AEF:681F763:5AEF27E7
Oh, I get it, I forgot to add token
to Authorization header when executed curl.
curl -i -X GET -H "Content-Type: application/json" -H "Authorization: token [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/commits
return a bunch of valid json. What's next? How can I print the contents of danger-response.json to ensure it's valid (or not)?
I've just shipped an update to danger-js which should show them in the logs now š
Here are the new logs:
danger:process Config: { stdoutOnly: undefined,
verbose: true,
jsonOnly: false,
dangerID: 'default' } +0ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Accept: application/vnd.github.v3.diff" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16 +0ms
danger:GitHubAPI getPullRequestCommits:: Sending pull request commit request for first page +0ms
danger:GitHubAPI getPullRequestCommits:: Request url generated "repos/org/Project/pulls/16/commits" +0ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/commits +890ms
danger:GitHubAPI getNextPageFromLinkHeader:: Given response does not contain link header for pagination +505ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16 +511ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/issues/16 +538ms
danger:GitHubAPI getPullRequestCommits:: Sending pull request commit request for first page +1s
danger:GitHubAPI getPullRequestCommits:: Request url generated "repos/org/Project/pulls/16/commits" +0ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/commits +478ms
danger:GitHubAPI getNextPageFromLinkHeader:: Given response does not contain link header for pagination +516ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Accept: application/vnd.github.v3+json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/reviews +516ms
danger:networking curl -i -X GET -H "Content-Type: application/json" -H "Accept: application/vnd.github.v3+json" -H "Authorization: [API TOKEN]" https://api.github.com/repos/org/Project/pulls/16/requested_reviewers +532ms
danger:process Sending input To danger-swift: { git:
{ modified_files:
[ 'Jenkinsfile',
'Project/Classes/Extensions/UIView+Extensions.swift',
'Project/Classes/Views/Button.swift' ],
created_files: [],
deleted_files:
[ 'Project/Resources/Assets.xcassets/image.imageset/Contents.json',
'Project' ],
commits:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ] },
github:
{ issue:
{ url: 'https://api.github.com/repos/org/Project/issues/16',
repository_url: 'https://api.github.com/repos/org/Project',
labels_url: 'https://api.github.com/repos/org/Project/issues/16/labels{/name}',
comments_url: 'https://api.github.com/repos/org/Project/issues/16/comments',
events_url: 'https://api.github.com/repos/org/Project/issues/16/events',
html_url: 'https://github.com/org/Project/pull/16',
id: 317541959,
number: 16,
title: 'remove borderWidth when button enabled',
user: [Object],
labels: [Object],
state: 'open',
locked: false,
assignee: [Object],
assignees: [Object],
milestone: null,
comments: 0,
created_at: '2018-04-25T09:12:18Z',
updated_at: '2018-05-06T13:37:41Z',
closed_at: null,
author_association: 'CONTRIBUTOR',
pull_request: [Object],
body: 'Remove Border:\r\nAdded blur for screen\r\n\r\n',
closed_by: null },
pr:
{ url: 'https://api.github.com/repos/org/Project/pulls/16',
id: 183969882,
html_url: 'https://github.com/org/Project/pull/16',
diff_url: 'https://github.com/org/Project/pull/16.diff',
patch_url: 'https://github.com/org/Project/pull/16.patch',
issue_url: 'https://api.github.com/repos/org/Project/issues/16',
number: 16,
state: 'open',
locked: false,
title: 'remove borderWidth when button enabled',
user: [Object],
body: 'Remove Border:\r\nAdded blur for screen\r\n\r\n',
created_at: '2018-04-25T09:12:18Z',
updated_at: '2018-05-06T13:37:41Z',
closed_at: null,
merged_at: null,
merge_commit_sha: 'eaa22dae217f8106a1a7ee30e50e78bafff89a96',
assignee: [Object],
assignees: [Object],
requested_reviewers: [Object],
requested_teams: [],
labels: [Object],
milestone: null,
commits_url: 'https://api.github.com/repos/org/Project/pulls/16/commits',
review_comments_url: 'https://api.github.com/repos/org/Project/pulls/16/comments',
review_comment_url: 'https://api.github.com/repos/org/Project/pulls/comments{/number}',
comments_url: 'https://api.github.com/repos/org/Project/issues/16/comments',
statuses_url: 'https://api.github.com/repos/org/Project/statuses/c94eeb8c65d67b45eb9ca77c93740196709a2f87',
head: [Object],
base: [Object],
_links: [Object],
author_association: 'CONTRIBUTOR',
merged: false,
mergeable: true,
rebaseable: true,
mergeable_state: 'blocked',
merged_by: null,
comments: 0,
review_comments: 6,
maintainer_can_modify: false,
commits: 8,
additions: 172,
deletions: 126,
changed_files: 16 },
commits:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ],
reviews: [ [Object], [Object], [Object], [Object] ],
requested_reviewers: { users: [Object], teams: [] },
thisPR: { number: 16, repo: 'Project', owner: 'org' } },
settings:
{ github:
{ accessToken: '[API TOKEN]',
additionalHeaders: {},
baseURL: undefined },
cliArgs: {} } } +4s
danger:runDangerSubprocess Running subprocess: danger-swift - +0ms
Executing pwd
Working directory: /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project
Ran with: Dangerfile.swift /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-dsl.json /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-response.json
ERROR: Failed to parse JSON: valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "danger", intValue: nil), CodingKeys(stringValue: "github", intValue: nil), CodingKeys(stringValue: "pr", intValue: nil), CodingKeys(stringValue: "head", intValue: nil), CodingKeys(stringValue: "repo", intValue: nil), CodingKeys(stringValue: "description", intValue: nil)], debugDescription: "Expected String value but found null instead.", underlyingError: nil))
Updating packages...
$ cd "/private/var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project/" && /usr/bin/env xcrun --sdk macosx swift package --version
Apple Swift Package Manager - Swift 4.1.0 (swiftpm-14050)
$ cd "/Users/user/.danger-swift/Packages/Generated/" && /usr/bin/env xcrun --sdk macosx swift package update
Everything is already up-to-date
$ cd "/Users/user/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/.build/" && ln -s "/Users/user/.danger-swift/Packages/Generated/.build/checkouts/" "checkouts"
$ cd "/Users/user/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/.build/" && ln -s "/Users/user/.danger-swift/Packages/Generated/.build/repositories/" "repositories"
$ cd "/Users/user/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/" && ln -s "/Users/user/.danger-swift/Packages/Generated/Package.resolved" "Package.resolved"
$ cd "/Users/user/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/" && ln -s "/private/var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project/_dangerfile_imports.swift" "OriginalFile"
$ cd "/Users/user/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/" && readlink OriginalFile
/private/var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project/_dangerfile_imports.swift
Cloning https://github.com/ashfurrow/danger-swiftlint.git...
$ cd "/Users/user/.danger-swift/Packages/Temp/" && git clone https://github.com/ashfurrow/danger-swiftlint.git Clone -q
Resolving latest major version for https://github.com/ashfurrow/danger-swiftlint.git...
Updating packages...
$ cd "/private/var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project/" && /usr/bin/env xcrun --sdk macosx swift package --version
Apple Swift Package Manager - Swift 4.1.0 (swiftpm-14050)
$ cd "/Users/user/.danger-swift/Packages/Generated/" && /usr/bin/env xcrun --sdk macosx swift package update
Fetching https://github.com/ashfurrow/danger-swiftlint.git
Fetching https://github.com/JohnSundell/Files.git
Fetching https://github.com/danger/danger-swift.git
Fetching https://github.com/JohnSundell/Marathon.git
Fetching https://github.com/JohnSundell/Unbox.git
Fetching https://github.com/JohnSundell/Wrap.git
Fetching https://github.com/JohnSundell/ShellOut.git
Fetching https://github.com/JohnSundell/Require.git
Fetching https://github.com/JohnSundell/Releases.git
Cloning https://github.com/JohnSundell/Unbox.git
Resolving https://github.com/JohnSundell/Unbox.git at 2.5.0
Cloning https://github.com/ashfurrow/danger-swiftlint.git
Resolving https://github.com/ashfurrow/danger-swiftlint.git at 0.3.7
Cloning https://github.com/JohnSundell/Files.git
Resolving https://github.com/JohnSundell/Files.git at 2.2.1
Cloning https://github.com/JohnSundell/Releases.git
Resolving https://github.com/JohnSundell/Releases.git at 3.0.0
Cloning https://github.com/JohnSundell/Marathon.git
Resolving https://github.com/JohnSundell/Marathon.git at 3.0.0
Cloning https://github.com/JohnSundell/Wrap.git
Resolving https://github.com/JohnSundell/Wrap.git at 3.0.1
Cloning https://github.com/JohnSundell/ShellOut.git
Resolving https://github.com/JohnSundell/ShellOut.git at 2.1.0
Cloning https://github.com/JohnSundell/Require.git
Resolving https://github.com/JohnSundell/Require.git at 2.0.1
Cloning https://github.com/danger/danger-swift.git
Resolving https://github.com/danger/danger-swift.git at 0.4.0
$ cd "/private/var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/Project/" && /usr/bin/env xcrun --sdk macosx swift package --version
Apple Swift Package Manager - Swift 4.1.0 (swiftpm-14050)
$ cd "/Users/user/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/" && /usr/bin/env xcrun --sdk macosx swift build -C /Users/user/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/
Compile Swift Module 'Files' (1 sources)
Compile Swift Module 'Danger' (9 sources)
Linking ./.build/x86_64-apple-macosx10.10/debug/libDanger.dylib
Compile Swift Module 'DangerSwiftLint' (3 sources)
Compile Swift Module '_dangerfile_imports' (1 sources)
Linking ./.build/x86_64-apple-macosx10.10/debug/_dangerfile_imports
Linking ./.build/x86_64-apple-macosx10.10/debug/libMarathonDependencies.dylib
Updating https://github.com/JohnSundell/Marathon.git
Updating https://github.com/JohnSundell/Wrap.git
Updating https://github.com/ashfurrow/danger-swiftlint.git
Updating https://github.com/JohnSundell/Unbox.git
Updating https://github.com/JohnSundell/Files.git
Updating https://github.com/JohnSundell/Releases.git
Updating https://github.com/danger/danger-swift.git
Updating https://github.com/JohnSundell/Require.git
Updating https://github.com/JohnSundell/ShellOut.git
Cloning https://github.com/JohnSundell/Unbox.git
Resolving https://github.com/JohnSundell/Unbox.git at 2.5.0
Cloning https://github.com/ashfurrow/danger-swiftlint.git
Resolving https://github.com/ashfurrow/danger-swiftlint.git at 0.3.0
Cloning https://github.com/JohnSundell/Files.git
Resolving https://github.com/JohnSundell/Files.git at 2.2.1
Cloning https://github.com/JohnSundell/Releases.git
Resolving https://github.com/JohnSundell/Releases.git at 3.0.0
Cloning https://github.com/JohnSundell/Marathon.git
Resolving https://github.com/JohnSundell/Marathon.git at 3.0.0
Cloning https://github.com/JohnSundell/Wrap.git
Resolving https://github.com/JohnSundell/Wrap.git at 3.0.1
Cloning https://github.com/JohnSundell/ShellOut.git
Resolving https://github.com/JohnSundell/ShellOut.git at 2.1.0
Cloning https://github.com/JohnSundell/Require.git
Resolving https://github.com/JohnSundell/Require.git at 2.0.1
Cloning https://github.com/danger/danger-swift.git
Resolving https://github.com/danger/danger-swift.git at 0.4.0
Running: /usr/bin/swiftc --driver-mode=swift -L /usr/local/lib/danger -I /usr/local/lib/danger -lDanger -L /usr/local/lib/danger -I /usr/local/lib/danger -L /Users/user/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/.build/debug -I /Users/user/.danger-swift/Scripts/Cache/-private-var-folders-g0-gzjvmzkx3lx44h6ff2pxspf00000gn-T-Project-_dangerfile_imports/.build/debug -lMarathonDependencies Dangerfile.swift /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-dsl.json /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-response.json
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/g0/gzjvmzkx3lx44h6ff2pxspf00000gn/T/danger-response.json
danger:runDangerSubprocess child process exited with code 1 +26s
danger:runDangerSubprocess Handling fail from subprocess +0ms
Error: TypeError: Cannot read property 'concat' of undefined
at Object.exports.mergeResults (/usr/local/lib/node_modules/danger/distribution/commands/utils/reporting.js:15:32)
at Object.<anonymous> (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:99:51)
at step (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:32:23)
at Object.next (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:13:53)
at /usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:7:71
at __awaiter (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:3:12)
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:87:48)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
OK that looks good, it looks like danger swift's JSON parser cannot handle a GitHub repo as having an empty description:
Once you de-parse this error message:
ERROR: Failed to parse JSON: valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "danger", intValue: nil), CodingKeys(stringValue: "github", intValue: nil), CodingKeys(stringValue: "pr", intValue: nil), CodingKeys(stringValue: "head", intValue: nil), CodingKeys(stringValue: "repo", intValue: nil), CodingKeys(stringValue: "description", intValue: nil)], debugDescription: "Expected String value but found null instead.", underlyingError: nil))
it's basically saying danger.github.pr.head.repo.description
is null
I'd recommend taking a shot at PRing this repo with a fix š
Thanks, fixed it by filling a repo description.
But... How is a repo description important for a pull-request validation? %) I mean, yeah, it's empty. It's a new repo and we haven't filled a description for it yet, but should it be a valid reason for danger-swift to fail? There are a lot of repos with empty descriptions, will they fail too? Also, if it is important, then shouldn't this be documented somewhere?
Yeah, this is just that JSON parsing in Swift is very strict, it just needs to be made nullable
If noone will make a PR for this - i'll try to do it on my vacations š Thanks again.
Good luck!
Trying to lint my swift project with danger-swiftlint plugin My DangerFile.swift is now:
And this is an output I get when running danger-swift:
And the weird thing is that all the same danger-swift and danger-swiftlint plugin works fine in my other private repo. Where should I start to dig to?