From b46dfdb198c7e7d621fc42a9ca54dcd6c255122e Mon Sep 17 00:00:00 2001 From: Ali Almohaya Date: Mon, 26 Sep 2022 23:28:51 +0300 Subject: [PATCH] chore: add actions to format and lint the code --- .github/workflows/lint.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/stylua_check.yml | 20 ++++++++++++++++++++ .luacheck | 6 ++++++ .luacheckrc | 6 ++++++ lua/openingh/init.lua | 3 +-- 5 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/stylua_check.yml create mode 100644 .luacheck create mode 100644 .luacheckrc diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..a7302f9 --- /dev/null +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.github/workflows/stylua_check.yml b/.github/workflows/stylua_check.yml new file mode 100644 index 0000000..b92f0e1 --- /dev/null +++ b/.github/workflows/stylua_check.yml @@ -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 diff --git a/.luacheck b/.luacheck new file mode 100644 index 0000000..0683f9c --- /dev/null +++ b/.luacheck @@ -0,0 +1,6 @@ +std = luajit +codes = true + +globals = { + "vim" +} diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..0683f9c --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,6 @@ +std = luajit +codes = true + +globals = { + "vim" +} diff --git a/lua/openingh/init.lua b/lua/openingh/init.lua index b719181..862f27f 100644 --- a/lua/openingh/init.lua +++ b/lua/openingh/init.lua @@ -46,10 +46,9 @@ function M.openRepo() return end - local repo_page_url = M.repo_url 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)