Files
doomemacs/.github/ci.el
Henrik Lissner 98274f2558 dev(ci): update commit linter config
To adapt to efforts made in 00e0733 to generalize its API.

Also fixes a 'Keyword argument :X not one of (:type)' error.

Ref: 4bae9ffa47
2022-05-05 15:35:42 +02:00

38 lines
1.3 KiB
EmacsLisp

;;; 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 '(docs "install" ci-check-docs-scope))
(add-to-list 'doom-cli-commit-scopes #'ci-check-module-scope)
;; DEPRECATED Will be removed once modules live in their own repo
(add-to-list 'doom-cli-commit-scopes '(release "modules"))
;;; Helpers
(cl-defun ci-check-module-scope (scope (&key type &allow-other-keys))
"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)))
(list (doom-dir (dir!) "../modules/")
(doom-dir doom-private-dir "modules/"))))
(defun ci-check-docs-scope (scope _)
"Allow any filename in docs/* as a scope for docs commits."
(member
scope (doom-files-in (doom-path (dir!) "../docs")
:match "\\.org$"
:map #'file-name-base)))
;;; ci.el ends here