chore: add actions to format and lint the code
This commit is contained in:
parent
920ce61eb6
commit
b46dfdb198
5 changed files with 62 additions and 2 deletions
29
.github/workflows/lint.yml
vendored
Normal file
29
.github/workflows/lint.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
# This is a basic workflow to help you get started with Actions
|
||||||
|
|
||||||
|
name: lint
|
||||||
|
|
||||||
|
# Controls when the action will run.
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
|
jobs:
|
||||||
|
# This workflow contains a single job called "build"
|
||||||
|
luacheck:
|
||||||
|
name: Luacheck
|
||||||
|
# The type of runner that the job will run on
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Runs a single command using the runners shell
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install luarocks
|
||||||
|
sudo luarocks install luacheck
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: sudo make lint
|
||||||
20
.github/workflows/stylua_check.yml
vendored
Normal file
20
.github/workflows/stylua_check.yml
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
name: lint
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "**"
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "**"
|
||||||
|
jobs:
|
||||||
|
stylua:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: JohnnyMorganz/stylua-action@1.0.0
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
|
# CLI arguments
|
||||||
|
args: --check --config-path stylua.toml --glob 'lua/**/*.lua' -- lua
|
||||||
|
# Specify `version` to pin a specific version, otherwise action will always use latest version/automatically update
|
||||||
6
.luacheck
Normal file
6
.luacheck
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
std = luajit
|
||||||
|
codes = true
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"vim"
|
||||||
|
}
|
||||||
6
.luacheckrc
Normal file
6
.luacheckrc
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
std = luajit
|
||||||
|
codes = true
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"vim"
|
||||||
|
}
|
||||||
|
|
@ -46,10 +46,9 @@ function M.openRepo()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local repo_page_url = M.repo_url
|
|
||||||
local current_branch_name = utils.get_current_branch()
|
local current_branch_name = utils.get_current_branch()
|
||||||
|
|
||||||
repo_page_url = M.repo_url .. "/tree/" .. current_branch_name
|
local repo_page_url = M.repo_url .. "/tree/" .. current_branch_name
|
||||||
|
|
||||||
local result = utils.open_url(repo_page_url)
|
local result = utils.open_url(repo_page_url)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue