From 9e143d1d84817ec7e6d139d234f0fff07749621c Mon Sep 17 00:00:00 2001 From: bdunahu Date: Mon, 27 Apr 2026 22:16:12 -0400 Subject: initial commit --- src/crawl-type-wrapper.scm | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/crawl-type-wrapper.scm (limited to 'src/crawl-type-wrapper.scm') diff --git a/src/crawl-type-wrapper.scm b/src/crawl-type-wrapper.scm new file mode 100644 index 0000000..359ac51 --- /dev/null +++ b/src/crawl-type-wrapper.scm @@ -0,0 +1,49 @@ +;; 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)) -- cgit v1.2.3