doomemacs/.github/ci.el
Henrik Lissner ab138c0b32
dev(ci): read scopes from local modules/docs
Instead of (only) reading the workflow's internal doomemacs install.

Amend: 0f6a653a13
2022-05-04 23:26:37 +02:00

36 lines
1.2 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 #'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)))
(list (doom-dir (dir!) "../modules/")
(doom-dir doom-private-dir "modules/"))))
(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 (dir!) "../docs/*.org"))))))
;;; ci.el ends here