dev(ci): use doomemacs/ci commit linter
And move repo-specific linter config into .github/ci.el
This commit is contained in:
parent
0db9014e89
commit
0f6a653a13
3 changed files with 40 additions and 18 deletions
35
.github/ci.el
vendored
Normal file
35
.github/ci.el
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
;;; ci.el -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||||
|
;;; Commentary:
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
;;; Types
|
||||||
|
(add-to-list 'doom-cli-commit-types 'module)
|
||||||
|
(add-to-list 'doom-cli-commit-scopeless-types 'module)
|
||||||
|
|
||||||
|
|
||||||
|
;;; Scopes
|
||||||
|
(add-to-list 'doom-cli-commit-scopes "cli")
|
||||||
|
(add-to-list 'doom-cli-commit-scopes "lib")
|
||||||
|
(add-to-list 'doom-cli-commit-scopes "docs")
|
||||||
|
(add-to-list 'doom-cli-commit-scopes #'ci-module-scope)
|
||||||
|
(add-to-list 'doom-cli-commit-scopes #'ci-docs-scope)
|
||||||
|
|
||||||
|
|
||||||
|
;;; Helpers
|
||||||
|
(cl-defun ci-module-scope (scope (&key type))
|
||||||
|
"Only allow :CATEGORY or MODULE scopes if they actually exist."
|
||||||
|
(seq-find (doom-rpartial
|
||||||
|
#'doom-glob (if (string-prefix-p ":" scope)
|
||||||
|
(format "%s" (substring scope 1))
|
||||||
|
(format "*/%s" scope)))
|
||||||
|
doom-modules-dirs))
|
||||||
|
|
||||||
|
(cl-defun ci-docs-scope (scope (&key type))
|
||||||
|
"Allow any filename in docs/* as a scope for docs commits."
|
||||||
|
(when (eq type 'docs)
|
||||||
|
(member scope
|
||||||
|
(cons "install"
|
||||||
|
(mapcar #'file-name-base
|
||||||
|
(doom-glob doom-docs-dir "*.org"))))))
|
||||||
|
|
||||||
|
;;; ci.el ends here
|
5
.github/workflows/lint-commits.yml
vendored
Normal file
5
.github/workflows/lint-commits.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
name: Lint commits
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
lint-commits:
|
||||||
|
uses: doomemacs/ci/.github/workflows/lint-commits.yml@legacy
|
18
.github/workflows/lint.yml
vendored
18
.github/workflows/lint.yml
vendored
|
@ -1,18 +0,0 @@
|
||||||
name: Commit linter
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
jobs:
|
|
||||||
lint-commits:
|
|
||||||
timeout-minutes: 10
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: styfle/cancel-workflow-action@0.9.1
|
|
||||||
with:
|
|
||||||
access_token: ${{ github.token }}
|
|
||||||
- uses: purcell/setup-emacs@master
|
|
||||||
with:
|
|
||||||
version: 27.2
|
|
||||||
- uses: actions/checkout@v2.3.1
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- run: bin/doom ci lint-commits ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
|
|
Loading…
Add table
Add a link
Reference in a new issue