🚧 Use Danger Swift GitHub Action

This commit is contained in:
Chris Araman 2021-11-18 13:50:25 -08:00 committed by Chris Araman
parent 425b935c2c
commit 0e35ac7cac
2 changed files with 36 additions and 0 deletions

16
.github/workflows/danger.yml vendored Normal file
View file

@ -0,0 +1,16 @@
name: Danger
on:
pull_request:
branches: [ main ]
jobs:
danger:
name: Danger
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Danger
uses: docker://ghcr.io/danger/danger-swift:3.12.2
with:
args: --failOnErrors --no-publish-check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

20
Dangerfile.swift Normal file
View file

@ -0,0 +1,20 @@
import Danger
let danger = Danger()
// Thanks other people!
if let github = danger.github {
let submitter = github.pullRequest.user.login
if submitter != "phatblat" && submitter != "chris-araman" {
danger.message(":tada: Thanks for your contribution, \(submitter)!")
}
// Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title
if github.pullRequest.body?.count ?? 0 < 5 {
danger.fail(":memo: Please provide a summary in the Pull Request description.")
}
// Make it more obvious that a PR is a work in progress and shouldn't be merged yet
if github.pullRequest.title.contains("[WIP]") {
danger.warn(":construction: Title includes `[WIP]`. Please convert the pull request to a Draft.")
}
}