From 005cbed3d24c3416817300aa06080a0abb1a2d5e Mon Sep 17 00:00:00 2001 From: Chorn Date: Thu, 3 Aug 2023 10:18:32 +0700 Subject: [PATCH] [#494] Replace danger-ruby with danger-kotlin --- .github/workflows/review_pull_request.yml | 25 +---------------------- Dangerfile.df.kts | 20 ++++++++++++++++++ 2 files changed, 21 insertions(+), 24 deletions(-) create mode 100644 Dangerfile.df.kts diff --git a/.github/workflows/review_pull_request.yml b/.github/workflows/review_pull_request.yml index 1b5f61fe3..31b3a4870 100644 --- a/.github/workflows/review_pull_request.yml +++ b/.github/workflows/review_pull_request.yml @@ -69,30 +69,7 @@ jobs: working-directory: ./template-compose run: ./gradlew koverMergedXmlReport - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - - - name: Cache gems - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - - name: Install Bundle and check environment versions - run: | - echo 'Install Bundle' - bundle config path vendor/bundle - bundle install - echo 'Check environment setup versions' - ruby --version - gem --version - bundler --version - - name: Run Danger + uses: danger/kotlin@1.2.0 env: DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: bundle exec danger diff --git a/Dangerfile.df.kts b/Dangerfile.df.kts new file mode 100644 index 000000000..b3448843a --- /dev/null +++ b/Dangerfile.df.kts @@ -0,0 +1,20 @@ +import systems.danger.kotlin.* + +danger(args) { + onGitHub { + // Make it more obvious that a PR is a work in progress and shouldn't be merged yet + if (pullRequest.title.contains("WIP", false)) { + warn("PR is classed as Work in Progress") + } + + // Warn when there is a big PR + if ((pullRequest.additions ?: 0) - (pullRequest.deletions ?: 0) > 500) { + warn("Big PR") + } + + // Warn to encourage a PR description + if (pullRequest.body?.isBlank() == true) { + warn("Please provide a summary in the PR description to make it easier to review") + } + } +}