Open dlewandaDK opened 1 year ago
If I'm understanding correctly the problem, I think you are using cwd at the contrary.
The cwd is used to define what should be the current working directory for Danger's execution.
So while you run swift run danger-swift ... --cwd ..
in the Danger folder, you can make Danger-Swift run like it was launched from your main directory (that in the example is ..
) and not from your Danger folder.
I'm not a native english speaker, so my explanation might not be great on the README, and might be misleading, in that case feel free to suggest a new wording :)
Thank you for your very prompt response here @f-meloni. I understand now what you intend, and I was able to make it work. I needed to prepend cd Danger;
inside my GitHub Action workflow script, which certainly isn't a big deal but maybe there is a future improvement to make it work the way I thought it should?
Either way, I will PR a change to help capture the current functionality in the README.
https://github.com/danger/swift/pull/552 is up for your perusal!
Actually, I may have spoken too soon. While things worked fine locally, when running in the context of my GitHub Action (on a self-hosted macOS runner), I get the following errors:
SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “Dangerfile.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/admin/<some_folder>/actions-runner/_work/<some_folder>/<some_folder>/Danger/Danger/Dangerfile.swift, NSUnderlyingError=0x600003d44030 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
[108](https://github.com/<GitHubOrg>/<GitHubPrivateRepo>/actions/runs/3714711423/jobs/6298976918#step:8:109)
SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “DangerProxy.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/admin/<some_folder>/actions-runner/_work/<some_folder>/<some_folder>/Danger/Danger/DangerProxy.swift, NSUnderlyingError=0x600003d58120 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
[109](https://github.com/<GitHubOrg>/<GitHubPrivateRepo>/actions/runs/3714711423/jobs/6298976918#step:8:110)
[110](https://github.com/<GitHubOrg>/<GitHubPrivateRepo>/actions/runs/3714711423/jobs/6298976918#step:8:111)
SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “Package.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/admin/<some_folder>/actions-runner/_work/<some_folder>/<some_folder>/Danger/Danger/Package.swift, NSUnderlyingError=0x600003d582d0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
The tl,dr there is that it's failing to find the 3 files I moved to the Danger directory because it appears to be appending an extra Danger directory name in the path:
/Users/admin/
Following the README section regarding moving the package out of the top level directory of the repo, I tried moving the
Dangerfile.swift
,Package.swift
, andPackage.resolved
file to a directory named Danger one level below my repo's top directory. When trying to run the command using--cwd Danger
or--cwd ./Danger
, I get the errorI have tried inserting the
--cwd
switch in every possible permutation I could think of (after the PR referenced by thepr
command argument, betweenpr
and the URL to the PR, beforepr
) and I get that error every time. Is there something else I should do to allow me to move those files into a subdirectory to gain the benefits the README calls out? If not, perhaps the feature isn't working as expected?