;; kenku --- crawl and reproduce github actions ;; Copyright © 2026 bdunahu ;; ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . (define-module (src crawl-type-wrapper) #:use-module (srfi srfi-1) #:use-module (ice-9 string-fun) #:use-module (ice-9 regex) #:use-module ((src utils) #:prefix util:) #:use-module ((src config) #:prefix conf:) #:use-module ((src crawl-newest-commits) #:prefix new-commit:) #:use-module (ice-9 textual-ports) #:export (crawl-types node-file)) (define mapdir (dirname new-commit:outfile)) (define mapfile (in-vicinity mapdir "external-to-type-map.txt")) (define typedir (in-vicinity conf:cache-dir "action-types")) (define node-file (in-vicinity typedir "node.txt")) (define file->regex `((,node-file . "node[0-9]{1,2}$") (,(in-vicinity typedir "docker.txt") . "docker$") (,(in-vicinity typedir "composite.txt") . "composite$"))) (define (parse-actions str) (filter (lambda (s) (not (string=? s ""))) (string-split str #\newline))) (define filter-actions) (define (crawl-types) (let* ((actions-to-type-sh (in-vicinity conf:scripts-dir "actions_to_type.sh"))) (system (string-append actions-to-type-sh " < " new-commit:outfile " >> " mapfile))) ;append mode (util:normalize-file mapfile) (util:filter-actions-on-regex mapfile file->regex parse-actions))