Skip to content

Commit

Permalink
Merge pull request #257 from VahidGarousi/kmp
Browse files Browse the repository at this point in the history
Refactor: Migrate Danger to Kotlin and update GitHub Actions
  • Loading branch information
Kaaveh authored Feb 9, 2025
2 parents f11414f + c208c27 commit 71204c2
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 42 deletions.
1 change: 1 addition & 0 deletions .github/.java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
23
27 changes: 10 additions & 17 deletions .github/workflows/danger_checks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Danger Checks

# This will cancel any in progress workflows for the same PR, if
# multiple pushes happen in quick succession.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
pull_request_target:
types: [ opened, synchronize, reopened ]
Expand All @@ -17,26 +23,13 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-version-file: .github/.java-version

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Set Up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
uses: gradle/gradle-build-action@v3

- name: Danger Checks
run: |
gem install bundler
bundle install
bundle exec danger
TOKEN='7469b4e94ce21b43e3ab7a'
TOKEN+='79960c12a1e067f2ec'
SECRET_TOKEN="${DANGER_GITHUB_API_TOKEN:-$GITHUB_TOKEN}"
DANGER_GITHUB_API_TOKEN=${SECRET_TOKEN:-$TOKEN} RUNNING_IN_ACTIONS=true npm run ci:danger || echo "Skipping Danger for External Contributor"
uses: danger/kotlin@1.3.2
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 0 additions & 20 deletions Dangerfile

This file was deleted.

30 changes: 30 additions & 0 deletions Dangerfile.df.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@file:Suppress("MagicNumber", "WildcardImport", "ForbiddenComment")

// Editing this file: https://github.com/danger/kotlin?tab=readme-ov-file#autocomplete-and-syntax-highlighting-in-intellij-idea-or-android-studio
import systems.danger.kotlin.*

danger(args) {

onGitHub {
val additions = pullRequest.additions ?: 0
val deletions = pullRequest.deletions ?: 0

message("Thanks @${pullRequest.user.login}!")

if (pullRequest.body.isNullOrBlank()) {
fail("Please provide a summary in the Pull Request description.")
}

if (additions > 500) {
warn("Please consider breaking up this pull request.")
}

if (issue.labels.isEmpty()) {
warn("Please add labels to this PR.")
}

if (deletions > additions) {
message("🎉 Code Cleanup!")
}
}
}
5 changes: 0 additions & 5 deletions Gemfile

This file was deleted.

0 comments on commit 71204c2

Please sign in to comment.