Skip to content

Commit

Permalink
Add PR validations to improve maintainability (#143)
Browse files Browse the repository at this point in the history
Resolves #26
  • Loading branch information
OptimumCode committed Jun 22, 2024
1 parent 46832ce commit 1754020
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
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 -> {}
}
}
}

0 comments on commit 1754020

Please sign in to comment.