diff --git a/.github/workflows/automation_remove_question_label_on_comment.yml b/.github/workflows/automation_remove_question_label_on_comment.yml index f99bba8..36f9336 100644 --- a/.github/workflows/automation_remove_question_label_on_comment.yml +++ b/.github/workflows/automation_remove_question_label_on_comment.yml @@ -8,7 +8,7 @@ jobs: # issues in my "needs triage" filter. remove_question: runs-on: ubuntu-latest - if: github.event.sender.login != 'stevearc' + if: github.event.sender.login != 'barrettruth' steps: - uses: actions/checkout@v4 - uses: actions-ecosystem/action-remove-labels@v1 diff --git a/.github/workflows/luarocks.yaml b/.github/workflows/luarocks.yaml index 4dc366c..9b6664e 100644 --- a/.github/workflows/luarocks.yaml +++ b/.github/workflows/luarocks.yaml @@ -7,7 +7,7 @@ on: jobs: quality: - uses: ./.github/workflows/tests.yml + uses: ./.github/workflows/quality.yaml publish: needs: quality diff --git a/.github/workflows/luarocks.yml b/.github/workflows/luarocks.yml deleted file mode 100644 index 999f728..0000000 --- a/.github/workflows/luarocks.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: luarocks - -on: - push: - tags: - - 'v*' - -jobs: - tests: - uses: ./.github/workflows/tests.yml - - publish: - needs: tests - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: nvim-neorocks/luarocks-tag-release@v7 - env: - LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} diff --git a/.github/workflows/mirror_upstream_prs.yml b/.github/workflows/mirror_upstream_prs.yml deleted file mode 100644 index af9cdb0..0000000 --- a/.github/workflows/mirror_upstream_prs.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Mirror Upstream PRs -on: - schedule: - - cron: "0 8 * * *" - workflow_dispatch: - -permissions: - issues: write - -jobs: - mirror: - runs-on: ubuntu-latest - steps: - - name: Mirror new upstream PRs - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const upstream = { owner: 'stevearc', repo: 'oil.nvim' }; - const fork = { owner: 'barrettruth', repo: 'oil.nvim' }; - - const since = new Date(); - since.setDate(since.getDate() - 1); - const sinceISO = since.toISOString(); - - const { data: prs } = await github.rest.pulls.list({ - ...upstream, - state: 'open', - sort: 'created', - direction: 'desc', - per_page: 30, - }); - - const recentPRs = prs.filter(pr => { - if (new Date(pr.created_at) < since) return false; - if (pr.user.login === 'dependabot[bot]') return false; - if (pr.user.login === 'dependabot-preview[bot]') return false; - return true; - }); - - if (recentPRs.length === 0) { - console.log('No new upstream PRs in the last 24 hours.'); - return; - } - - const { data: existingIssues } = await github.rest.issues.listForRepo({ - ...fork, - state: 'all', - labels: 'upstream/pr', - per_page: 100, - }); - - const mirroredNumbers = new Set(); - for (const issue of existingIssues) { - const match = issue.title.match(/^upstream#(\d+)/); - if (match) mirroredNumbers.add(parseInt(match[1])); - } - - for (const pr of recentPRs) { - if (mirroredNumbers.has(pr.number)) { - console.log(`Skipping PR #${pr.number} — already mirrored.`); - continue; - } - - const labels = pr.labels.map(l => l.name).join(', ') || 'none'; - - await github.rest.issues.create({ - ...fork, - title: `upstream#${pr.number}: ${pr.title}`, - body: [ - `Mirrored from [stevearc/oil.nvim#${pr.number}](${pr.html_url}).`, - '', - `**Author:** @${pr.user.login}`, - `**Labels:** ${labels}`, - `**Created:** ${pr.created_at}`, - '', - '---', - '', - pr.body || '*No description provided.*', - ].join('\n'), - labels: ['upstream/pr'], - }); - - console.log(`Created issue for upstream PR #${pr.number}: ${pr.title}`); - } diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml new file mode 100644 index 0000000..9691be9 --- /dev/null +++ b/.github/workflows/quality.yaml @@ -0,0 +1,90 @@ +name: quality + +on: + workflow_call: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + lua: ${{ steps.changes.outputs.lua }} + markdown: ${{ steps.changes.outputs.markdown }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + lua: + - 'lua/**' + - 'plugin/**' + - 'spec/**' + - '*.lua' + - '.luarc.json' + - '*.toml' + markdown: + - '*.md' + + lua-format: + name: Lua Format Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} + steps: + - uses: actions/checkout@v4 + - uses: JohnnyMorganz/stylua-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: 2.1.0 + args: --check lua spec + + lua-lint: + name: Lua Lint Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} + steps: + - uses: actions/checkout@v4 + - name: Lint with Selene + uses: NTBBloodbath/selene-action@v1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --display-style quiet . + + lua-typecheck: + name: Lua Type Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} + steps: + - uses: actions/checkout@v4 + - name: Run Lua LS Type Check + uses: mrcjkb/lua-typecheck-action@v0 + with: + checklevel: Warning + directories: lua + configpath: .luarc.json + + markdown-format: + name: Markdown Format Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.markdown == 'true' }} + steps: + - uses: actions/checkout@v4 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Install prettier + run: pnpm add -g prettier@3.1.0 + - name: Check markdown formatting with prettier + run: prettier --check . diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..6910389 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,22 @@ +name: test + +on: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + nvim: [stable, nightly] + name: Test (Neovim ${{ matrix.nvim }}) + steps: + - uses: actions/checkout@v4 + + - uses: nvim-neorocks/nvim-busted-action@v1 + with: + nvim_version: ${{ matrix.nvim }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 33fe515..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Tests - -on: - workflow_call: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - selene: - name: Selene - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: NTBBloodbath/selene-action@v1.0.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --display-style quiet . - - stylua: - name: StyLua - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Stylua - uses: JohnnyMorganz/stylua-action@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - version: v2.1.0 - args: --check lua spec - - typecheck: - name: typecheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: mrcjkb/lua-typecheck-action@v0 - with: - checklevel: Warning - directories: lua - configpath: .luarc.json - - run_tests: - strategy: - fail-fast: false - matrix: - nvim_version: - - stable - - nightly - - name: Run tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: nvim-neorocks/nvim-busted-action@v1 - with: - nvim_version: ${{ matrix.nvim_version }}