diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 7e40ad96..175e316d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -56,3 +56,19 @@ jobs: upload-code-coverage: true secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + danger-check: + runs-on: ubuntu-latest + permissions: + pull-requests: write + statuses: write + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v4 + - name: Danger + uses: danger/kotlin@1.3.1 + with: + run-mode: ci + dangerfile: Dangerfile.df.kts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/Dangerfile.df.kts b/Dangerfile.df.kts new file mode 100644 index 00000000..e4eb8d6f --- /dev/null +++ b/Dangerfile.df.kts @@ -0,0 +1,17 @@ +@file:Suppress("ktlint:standard:no-wildcard-imports") + +import systems.danger.kotlin.* + +danger(args) { + onGitHub { + val prLabels = issue.labels + when (prLabels.size) { + 0 -> fail("PR must have labels") + 1 -> + prLabels.find { it.name.equals("ignore", ignoreCase = true) }?.let { + warn("PR must have labels other then '[${it.name}](${it.url})'") + } + else -> {} + } + } +} \ No newline at end of file