Created
August 16, 2023 09:24
-
-
Save jasonm23/b02b1833b0ad15c005288da079f97a37 to your computer and use it in GitHub Desktop.
Emacs github-actions-mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; github-actions-mode --- Minor mode for github-actions | |
;;; | |
;;; Commentary: | |
;;; Used to add actionlint flycheck checker and github environment var names | |
;;; | |
;;; Code: | |
(require 'flycheck) | |
(require 'company-dabbrev) | |
(flycheck-define-checker yaml-actionlint | |
"A YAML syntax checker using actionlint." | |
:command ("actionlint" "-oneline" source) | |
:error-patterns ((error line-start (file-name) ":" line ":" column ": " (message) line-end)) | |
:modes yaml-mode) | |
(add-to-list 'flycheck-checkers 'yaml-actionlint) | |
(define-minor-mode github-actions-mode | |
"Minor mode for GitHub Actions related features." | |
:init-value nil | |
:lighter " GH-Actions" | |
:keymap (let ((map (make-sparse-keymap))) | |
(define-key map (kbd "C-c C-a c") 'github-actions-dabbrev-expand) | |
map) | |
(add-to-list 'company-backends '(company-capf company-dabbrev)) | |
(yaml-actionlint-setup)) | |
(defun yaml-actionlint-setup () | |
"Setup actionlint as a Flycheck checker for yaml-mode." | |
(interactive) | |
(when (eq major-mode 'yaml-mode) | |
(flycheck-add-next-checker 'yaml-yamllint 'yaml-actionlint))) | |
(defvar github-actions-dabbrev-abbrevs | |
'(("summary" . "$GITHUB_STEP_SUMMARY") | |
("secrets" . "$GITHUB_SECRETS"))) | |
(provide 'github-actions-mode) | |
;;; github-actions-mode.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just threw this together today and still user testing it before moving it to org:emacsfodder