Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.
/ ktfmt-action Public archive
generated from actions/typescript-action

Github Action which ensures that Kotlin source code follows ktfmt style

License

Notifications You must be signed in to change notification settings

rsookram/ktfmt-action

Repository files navigation

ktfmt-action status

ktfmt-action

Github Action which ensures that Kotlin source code follows ktfmt style.

Usage

Inputs

style

(Optional) The style the code should be formatted as (dropbox, google, or kotlinlang). Defaults to facebook style.

path

(Optional) The file or directory to apply ktfmt to. Defaults to all Kotlin files in the repository.

Example

name: ktfmt

on:
  pull_request:
    paths:
      - "**/*.kt"
      - ".github/workflows/ktfmt.yml"

 jobs:
   ktlint:
     runs-on: ubuntu-latest

     steps:
       - uses: actions/checkout@v2

       - uses: actions/setup-java@v2
         with:
           distribution: 'adopt'
           java-version: '11'

       - name: "ktfmt"
         uses: rsookram/ktfmt-action@v1
         with:
           style: kotlinlang

Development

You'll need to have a reasonably modern version of node handy. This won't work with versions older than 9, for instance.

Install the dependencies

$ npm install

Build the typescript and package it for distribution

$ npm run build && npm run package

Run the tests

$ npm test

License

MIT