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

Refactor: Migrate Danger to Kotlin and update GitHub Actions #257

Merged
merged 1 commit into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.