Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PR validations to improve maintainability #143

Merged
merged 13 commits into from
Jun 22, 2024
16 changes: 16 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

17 changes: 17 additions & 0 deletions Dangerfile.df.kts
Original file line number Diff line number Diff line change
@@ -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 -> {}
}
}
}
Loading