Skip to content

Commit

Permalink
ci: add commit and code linting
Browse files Browse the repository at this point in the history
  • Loading branch information
AdeAttwood committed Feb 1, 2024
1 parent f5bdd00 commit 0e22280
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ct-commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Conventional Tools Commitlint

on:
push: { branches: ["0.x"] }
pull_request: { branches: ["0.x"] }

jobs:
commits:
name: Commitlint
runs-on: ubuntu-latest
container: practically/conventional-tools:1.x@sha256:647d6e4b3edfcbac6054b90f74d2c61a022152751b94484d54e13695a9e27377
steps:
- name: Checkout
uses: actions/checkout@v4
with: { fetch-depth: 1000 }

- name: Git safe.directory
run: git config --global --add safe.directory $PWD

- name: Lint commits
run: conventional-tools commitlint -l1
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint

on:
push: { branches: ["0.x"] }
pull_request: { branches: ["0.x"] }

jobs:
luacheck:
name: Luacheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install luarocks
run: sudo apt update && sudo apt install -y luarocks

- name: Install luacheck
run: sudo luarocks install luacheck

- name: Run luacheck
run: luacheck .

stylua:
name: StyLua
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run stylua
uses: JohnnyMorganz/stylua-action@v3.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .
2 changes: 1 addition & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ codes = true
self = false

-- Global objects defined by the C code
read_globals = { "vim" }
read_globals = { "vim", "describe", "it", "assert" }
2 changes: 1 addition & 1 deletion lua/sapling_scm/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local client = {}
--
---@return HeadInfo
client.head_info = function()
local head_info = vim.fn.system([[sl log -r '.' -T"{dict(remotenames,node,peerurls)|json}"]])
local head_info = vim.fn.system [[sl log -r '.' -T"{dict(remotenames,node,peerurls)|json}"]]
return vim.json.decode(head_info)
end

Expand Down

0 comments on commit 0e22280

Please sign in to comment.