{"id":19945592,"url":"https://github.com/danger/kotlin","last_synced_at":"2025-05-15T04:05:47.707Z","repository":{"id":39461097,"uuid":"157427838","full_name":"danger/kotlin","owner":"danger","description":"⚠️ Stop saying \"you forgot to …\" in code review","archived":false,"fork":false,"pushed_at":"2025-03-10T22:03:17.000Z","size":2375,"stargazers_count":517,"open_issues_count":27,"forks_count":50,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-14T05:55:36.425Z","etag":null,"topics":["ci-cd","hacktoberfest","notifications","pull-requests","reporting"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danger.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["f-meloni","gianluz"]}},"created_at":"2018-11-13T18:36:21.000Z","updated_at":"2025-04-09T15:22:39.000Z","dependencies_parsed_at":"2023-11-15T04:30:59.427Z","dependency_job_id":"19bcff47-77f7-4d1b-8bde-45311b37d030","html_url":"https://github.com/danger/kotlin","commit_stats":{"total_commits":704,"total_committers":32,"mean_commits":22.0,"dds":0.5568181818181819,"last_synced_commit":"18747b062fa73161c68b1e8a007861f41f0f15b7"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danger%2Fkotlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danger%2Fkotlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danger%2Fkotlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danger%2Fkotlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danger","download_url":"https://codeload.github.com/danger/kotlin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270646,"owners_count":22042859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci-cd","hacktoberfest","notifications","pull-requests","reporting"],"created_at":"2024-11-13T00:26:06.693Z","updated_at":"2025-05-15T04:05:42.685Z","avatar_url":"https://github.com/danger.png","language":"Kotlin","funding_links":["https://github.com/sponsors/f-meloni","https://github.com/sponsors/gianluz"],"categories":[],"sub_categories":[],"readme":"[![Current \nVersion](https://img.shields.io/badge/danger%20kotlin-v1.3.3-orange)](https://danger.systems/kotlin/)\n[![Maven Central - SDK](https://img.shields.io/maven-central/v/systems.danger/danger-kotlin-sdk.svg?label=danger-kotlin-sdk)](https://search.maven.org/search?q=g:%22systems.danger%22%20AND%20a:%22danger-kotlin-sdk%22)\n[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=200 src=\"https://danger.systems/images/js/danger-js-ktln-logo-hero-cachable@2x.png\" /\u003e\u003c/br\u003e\n⚠️ Stop saying \"you forgot to …\" in code review in Kotlin\n\u003c/p\u003e\n\n# Project status\nThe project is now on a stable version.\nIs possible to generate a working `danger-kotlin` instance from the code that is currently on this repo, or use it via GitHub actions or `brew`.\n\n### What it looks like today\nYou can make a `Dangerfile.df.kts` in your root project that looks through PR metadata, it's fully typed.\n\n```kotlin\nimport systems.danger.kotlin.*\n\ndanger(args) {\n\n    val allSourceFiles = git.modifiedFiles + git.createdFiles\n    val changelogChanged = allSourceFiles.contains(\"CHANGELOG.md\")\n    val sourceChanges = allSourceFiles.firstOrNull { it.contains(\"src\") }\n\n    onGitHub {\n        val isTrivial = pullRequest.title.contains(\"#trivial\")\n\n        // Changelog\n        if (!isTrivial \u0026\u0026 !changelogChanged \u0026\u0026 sourceChanges != null) {\n            warn(WordUtils.capitalize(\"any changes to library code should be reflected in the Changelog.\\n\\nPlease consider adding a note there and adhere to the [Changelog Guidelines](https://github.com/Moya/contributors/blob/master/Changelog%20Guidelines.md).\"))\n        }\n\n        // Big PR Check\n        if ((pullRequest.additions ?: 0) - (pullRequest.deletions ?: 0) \u003e 300) {\n            warn(\"Big PR, try to keep changes smaller if you can\")\n        }\n\n        // Work in progress check\n        if (pullRequest.title.contains(\"WIP\", false)) {\n            warn(\"PR is classed as Work in Progress\")\n        }\n    }\n}\n```\n\n### Setup\n\n### Docker\n```sh\ndocker run --rm -v \"${PWD}:/code\" -w /code ghcr.io/danger/danger-kotlin:1.3.3 danger-kotlin local\n```\n\n#### macOS (ARM)\n```sh\nbrew install danger/tap/danger-kotlin\n```\n\n#### macOS (Intel)\n```sh\nbrew install danger/tap/danger-kotlin-intel\n```\n\nYou need to have Xcode installed and not relying on command line tools.\nIf you're seeing this error when running xcodebuild:\n\n```sh\n$ xcodebuild -version\nxcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance\n```\n\nYou can fix it with:\n\n```sh\nsudo xcode-select -s /Applications/Xcode.app/Contents/Developer\n```\n\n### Linux\n```sh\nbash \u003c(curl -s https://raw.githubusercontent.com/danger/kotlin/master/scripts/install.sh)\nsource ~/.bash_profile\n```\n\n### GitHub Actions\nYou can add danger/kotlin to your actions\n\nParameters:\n* `dangerfile`: Path to danger file,  required: `false`,  default: `Dangerfile.df.kts`\n* `run-mode`: Run mode: `ci`, `local`, `pr`, required: `false`  default: `ci`\n* `job-id:` Reported CI job ID, required: `false`, default: `danger/kotlin`\n* `args`: Extra custom arguments like \"--failOnErrors --no-publish-check\" and etc, required: `false`\n\n```yml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    name: \"Run Danger\"\n    steps:\n      - uses: actions/checkout@v4\n      - name: Danger\n        uses: danger/kotlin@1.3.3\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\nDanger a pre built images that you can use with your action:\n\nhttps://github.com/orgs/danger/packages/container/package/danger-kotlin\nIn order to import one of those use the docker:// prefix\n\n```yml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    name: \"Run Danger\"\n    container:\n      image: docker://ghcr.io/danger/danger-kotlin:1.3.3\n    steps:\n      - uses: actions/checkout@v4\n      - name: Run Danger\n        run: danger-kotlin ci --failOnErrors --no-publish-check\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Autocomplete and Syntax highlighting in IntelliJ IDEA or Android Studio\nYou can activate the autocomplete following this additional steps:\n- Install danger on your local machine\n- Go to `Preferences -\u003e Build, Execution, Deployment -\u003e Compiler -\u003e Kotlin Compiler` (`Preferences -\u003e Kotlin Compiler` in Android Studio, Recent Android Studio versions will show this option when you close all project and open the Settings from the initial screen)\n- At the bottom you will find a section `Kotlin Scripting`\n- Complete the field `Script template classes` with  `systems.danger.kts.DangerFileScript`\n- Complete the field `Script templates classpath` with `/usr/local/lib/danger/danger-kotlin.jar`\n- Go to `Preferences -\u003e Language \u0026 Frameworks -\u003e Kotlin -\u003e Kotlin Scripting`\n- Make sure the script template `DangerFileScript` is active and above the default `Kotlin Script`\n- Apply changes\n- If opening the `Dangerfile.df.kts` the autocomplete and syntax highlighting doesn't work, try to reboot your IDE or open the Dangerfile from your IDE as a single file.\n- If it still doesn't work, go to `Help -\u003e Edit Custom VM Options...` and add `-Dkotlin.script.classpath=\u003cpath\u003e/danger-kotlin.jar` (replace the `\u003cpath\u003e` with the absolute path to the JAR). Then restart the IDE.\n- You may also need to disable the \"K2 mode\" (search the settings for it) if you enabled it previously.\n\n\n### Using external maven dependencies into your Dangerfile\nYou can use any external dependency by adding the following lines at the top of your `Dangerfile.df.kts`\n```kotlin\n@file:Repository(\"https://repo.maven.apache.org\")\n@file:DependsOn(\"groupId:artifactId:version\")\n```\n\n### Commands\n\n- `danger-kotlin ci` - Use this on CI\n- `danger-kotlin pr https://github.com/Moya/Harvey/pull/23` - Use this to build your Dangerfile\n- `danger-kotlin local` - Use this to run danger against your local changes from master\n\n# Authors\n`danger-kotlin` was developed by [@gianluz][] and [@f-meloni][]\n\n[@f-meloni]: https://github.com/f-meloni\n[@gianluz]: https://github.com/gianluz\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanger%2Fkotlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanger%2Fkotlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanger%2Fkotlin/lists"}