diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml new file mode 100644 index 0000000..3e2018a --- /dev/null +++ b/.github/workflows/danger.yml @@ -0,0 +1,26 @@ +name: Run Danger +on: + workflow_dispatch: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + +jobs: + build: + if: github.event.pull_request.draft == false + name: Run Danger + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write + steps: + - name: Git checkout + uses: actions/checkout@v4 + - name: Danger + uses: 417-72KI/danger-swiftlint@v5.9 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dangerfile.swift b/Dangerfile.swift new file mode 100644 index 0000000..803fffc --- /dev/null +++ b/Dangerfile.swift @@ -0,0 +1,15 @@ +import Danger + +extension String: Error {} + +let danger = Danger() + +if danger.github.pullRequest.body == nil { + danger.fail("Please add a description to this Pull Request") +} + +SwiftLint + .lint( + .all(directory: nil), + configFile: ".swiftlint.yml" + )