-
Notifications
You must be signed in to change notification settings - Fork 3.1k
How to run Danger swift
lmarceau edited this page Oct 22, 2025
·
3 revisions
We're using Danger Swift in our CI pipeline to automate some code checks on pull requests. Here's how you can modify and run the Dangerfile.swift.
Let’s run the Dangerfile.swift against an existing PR. It will only leave messages in your terminal, not on the PR. Those steps are sumamrized from the Danger documentation.
- You can install
Dangerlocally withBrewrunningbrew install danger/tap/danger-swift. - Create a personal access token here since
Dangerneeds it to run. Take note of that access token somewhere safe. - Add your token to your terminal
export DANGER_GITHUB_API_TOKEN='your_token' - You can then run the
Dangerfile.swiftlocally on an opened PR with the commandswift run danger-swift pr https://github.com/mozilla-mobile/firefox-ios/pull/TODO. Just replace the command with the PR number you want it to run on.
Some parts of the Dangerfile.swift code relies on the code coverage information. To run those specific functions, you need to generate the code coverage JSON file with the following command. Replace the TODO with your own derived data information.
xcrun xccov view --report --json ~/Library/Developer/Xcode/DerivedData/Client-TODO/Logs/Test/*.xcresult > coverage.json
You can refer to the Danger Github API here.