{"id":18322433,"url":"https://github.com/sureshg/kts-exec","last_synced_at":"2025-08-27T13:09:14.069Z","repository":{"id":43001694,"uuid":"405864266","full_name":"sureshg/kts-exec","owner":"sureshg","description":":bullettrain_side: A composite Github Action to execute the Kotlin Script with compiler plugin and dependency caching!","archived":false,"fork":false,"pushed_at":"2024-07-05T17:43:37.000Z","size":58,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-05T13:47:26.243Z","etag":null,"topics":["compiler-plugin","github-action","jvm","kotlin","kotlin-script","kotlinx-serialization"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sureshg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-13T06:52:06.000Z","updated_at":"2025-01-07T14:32:18.000Z","dependencies_parsed_at":"2025-04-05T23:31:11.204Z","dependency_job_id":"13ee7f54-3d9f-46e9-ad45-6877a67663c6","html_url":"https://github.com/sureshg/kts-exec","commit_stats":{"total_commits":36,"total_committers":3,"mean_commits":12.0,"dds":"0.11111111111111116","last_synced_commit":"3ac7b4cd5aeae4b236a59ccdd68467f2982dc43a"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/sureshg/kts-exec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sureshg%2Fkts-exec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sureshg%2Fkts-exec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sureshg%2Fkts-exec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sureshg%2Fkts-exec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sureshg","download_url":"https://codeload.github.com/sureshg/kts-exec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sureshg%2Fkts-exec/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266983422,"owners_count":24016553,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["compiler-plugin","github-action","jvm","kotlin","kotlin-script","kotlinx-serialization"],"created_at":"2024-11-05T18:24:37.052Z","updated_at":"2025-07-25T09:03:24.565Z","avatar_url":"https://github.com/sureshg.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kotlin Script Github Action\n\n[![Version][gh_action_img]][gh_action] [![Kotlin Script Test][workflow_img]][workflow_url]\n\n[Kotlin][0] can also be used as a scripting language, which is safer, concise, and fun to write\nthan `bash` or `python`. GitHub has recently [enabled][3] `Kotlin` on `Github Action` runners, which\nenables us to use [Kotlin Script][1] on GitHub Action out of the box. But using compiler plugins \n(eg: [kotlinx-serialization][2]) is not straightforward with Kotlin script and requires a bit of\nfiddling. `kts-exec` is a composite GitHub Action to execute the Kotlin Script (on `mac`/`linux`\n/`windows`) with a given kotlin compiler plugin and `dependency caching`.\n\n## Inputs\n\n### `script`\n\n**Required** The Kotlin script to execute. Default script name is `script.main.kts`.\n\n### `compiler-plugin`\n\n**Optional** Kotlin compiler plugin to use. Currently, supported values are\n\n- `kotlinx-serialization` (**Default**)\n- `allopen`\n- `noarg`\n- `lombok`\n- `sam-with-receiver`\n- `kotlin-imports-dumper`\n\n### `cache`\n\n**Optional** Enable kotlin script dependencies caching. It is enabled (`true`) by default.\n\n## Outputs\n\n### `plugin-path`\n\nLocal path to the kotlin `compiler-plugin`. You may also access the path via `${{ env.PLUGIN_PATH }}`.\n\n### `kotlin-root`\n\nThe kotlin installation path. You may also access the path via `${{ env.KOTLIN_ROOT }}`.\n\n## Usage\n\nSay, you want to execute the kotlin script with a `Serializable` data class for JSON processing\n\n\u003cdetails open\u003e\n\u003csummary\u003escript.main.kts\u003c/summary\u003e\n\n```kotlin\n@file:DependsOn(\"org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2\")\n\nimport kotlinx.serialization.*\nimport kotlinx.serialization.json.*\n\n@Serializable\ndata class Lang(val name: String, val version: String)\n\nval arg = args.firstOrNull() ?: \"Kotlin\"\nprintln(\"Hello $arg!\")\n\nval serialized = Json.encodeToString(Lang(\"Kotlin\", KotlinVersion.CURRENT.toString()))\nprintln(serialized)\n```\n\n\u003c/details\u003e  \n\nAdd the `kt-exec` to your workflow and run your kotlin script.\n\n```yml\njobs:\n  build:\n    runs-on: ubuntu-lastest\n    steps:\n      - name: Check out repository\n        uses: actions/checkout@v4\n\n      - name: Run Kotlin Script\n        uses: sureshg/kts-exec@v2.7\n        with:\n          script: \"script.main.kts\"\n```\n\n[0]: https://kotlinlang.org/\n\n[1]: https://kotlinlang.org/docs/command-line.html#run-scripts\n\n[2]: https://kotlinlang.org/docs/serialization.html\n\n[3]: https://github.com/actions/virtual-environments/issues/3687\n\n[gh_action_img]: https://img.shields.io/github/v/tag/sureshg/kts-exec?color=24292e\u0026label=Github%20Action\u0026logo=Github\u0026logoColor=ffffff\u0026style=for-the-badge\n[gh_action]: https://github.com/marketplace/actions/execute-kotlin-script\n\n[workflow_img]: https://img.shields.io/github/actions/workflow/status/sureshg/kts-exec/test.yml?branch=main\u0026color=green\u0026label=Kotlin%20Script%20Test\u0026logo=github%20actions\u0026logoColor=green\u0026style=for-the-badge\n[workflow_url]: https://github.com/sureshg/kts-exec/actions/workflows/test.yml\n\n[composite_actions_syntax]: https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-actions\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsureshg%2Fkts-exec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsureshg%2Fkts-exec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsureshg%2Fkts-exec/lists"}