diff options
| author | bdunahu <bdunahu@operationnull.com> | 2026-04-27 22:16:12 -0400 |
|---|---|---|
| committer | bdunahu <bdunahu@operationnull.com> | 2026-04-28 00:15:09 -0400 |
| commit | 9e143d1d84817ec7e6d139d234f0fff07749621c (patch) | |
| tree | 7565eac131cc3528d33d5ea3597cdd8006fdb968 /src/crawl-type-wrapper.scm | |
Diffstat (limited to 'src/crawl-type-wrapper.scm')
| -rw-r--r-- | src/crawl-type-wrapper.scm | 49 |
1 files changed, 49 insertions, 0 deletions
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 <bdunahu@operationnull.com> +;; +;; 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 <https://www.gnu.org/licenses/>. + +(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)) |
