#!/usr/bin/env bash # 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 . # # Takes a file with one repo per line and outputs a master list # of REPO, ACTION pairs. This script takes a long time to run. # There is an obvious part of this script that is pretty gross. # I got it working sometime in early march and have forgotten # why it does what it does. function get_flows { curl -s \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $TOKEN" \ "https://api.github.com/repos/$1/$2/contents/.github/workflows" } function has_flows { echo "$1" \ | jq -e 'type == "object" and has("message") | not' >/dev/null 2>&1 } function get_url { local owner repo flows owner=$(echo "$1" | awk -F'/' '{print $(NF-1)}') repo=$(echo "$1" | awk -F'/' '{print $(NF)}') flows=$(get_flows "$owner" "$repo") has_flows "$flows" && echo "$flows" | jq -r '.[] | select(.type=="file") | .download_url' \ | xargs -n1 sh -c ' for url do curl -s "$url" | grep -E "^\s*-?\s*uses:" | sed "s|.*uses:\s*|$1 |" done ' _ "$1" # passes arg to sh -c } while read -r url; do get_url "$url" done