🐧🧹 HealthChecks 🖳🗑️ #15
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
name: 🐧🧹 HealthChecks 🖳🗑️ | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
on: | |
#push: | |
workflow_dispatch: | |
schedule: | |
# - cron: "45 03 * * *" # 03:45 AM UTC --> 09:30 AM Morning NPT | |
- cron: "0 */12 * * *" # Every 12 Hrs | |
#env: | |
#GHCR_TOKEN: "${{ secrets.GHCR_TOKEN }}" | |
#RCLONE_CF_R2_PUB: "${{ secrets.RCLONE_CF_R2_PUB }}" | |
jobs: | |
#------------------------------------------------------------------------------------# | |
check-post: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
path: main | |
filter: "blob:none" | |
- name: Setup Env | |
run: | | |
##presets | |
set +x ; set +e | |
#-------------# | |
##CoreUtils | |
sudo apt update -y | |
sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y | |
sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null | |
#temp | |
SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" | |
echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" | |
##Setup rClone | |
mkdir -p "${HOME}/.config/rclone" | |
echo "${{ secrets.RCLONE_CF_R2_PUB }}" > "${HOME}/.config/rclone/rclone.conf" | |
export RCLONE_STATS="120s" ; echo "RCLONE_STATS=${RCLONE_STATS}" >> "${GITHUB_ENV}" | |
##User-Agent | |
USER_AGENT="$(curl -qfsSL 'https://pub.ajam.dev/repos/Azathothas/Wordlists/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" | |
echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" | |
continue-on-error: true | |
- name: Install Addons | |
run: | | |
#presets | |
set +x ; set +e | |
#-------------# | |
bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh") | |
continue-on-error: true | |
- name: Dos2Unix Everything | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
cd "${GITHUB_WORKSPACE}/main" | |
find . -type f ! -path "./.git/*" -exec dos2unix {} \; 2>/dev/null | |
continue-on-error: true | |
- name: ActionLint | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
cd "${GITHUB_WORKSPACE}/main" | |
find ".github/workflows" -type f -name "*ml" -exec actionlint {} \; | |
continue-on-error: true | |
- name: Shellcheck | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
cd "${GITHUB_WORKSPACE}/main" | |
find ".github" -type f -name '*.sh' -exec shellcheck --exclude="SC2261" --severity=error "{}" \; 2>/dev/null | tee "${GITHUB_WORKSPACE}/main/.github/shellcheck.txt" | |
continue-on-error: true | |
- name: Generate Repo Metadata (git-sizer) | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
cd "${GITHUB_WORKSPACE}/main" | |
#Dust sizes | |
echo '```mathematica' > "${GITHUB_WORKSPACE}/main/.github/SIZE.md" | |
dust -b -c -i -r -n 99999999 "${GITHUB_WORKSPACE}/main" | tee -a "${GITHUB_WORKSPACE}/main/.github/SIZE.md" | |
dust -b -c -i -r -n 99999999 "${GITHUB_WORKSPACE}/main" | tee "${GITHUB_WORKSPACE}/main/.github/SIZE.txt" | |
echo '```' >> "${GITHUB_WORKSPACE}/main/.github/SIZE.md" | |
continue-on-error: true | |
- name: Generate Dynamic Data | |
run: | | |
#Presets | |
set +x ; set +e ; ulimit -S -s unlimited ; ulimit -f unlimited 2>/dev/null | |
#--------------# | |
##Total (Bincache) | |
jq -n '[ | |
{host: "x86_64-Linux", total: '"$(curl -qfsSL 'https://meta.pkgforge.dev/bincache/x86_64-Linux.json' | jq -r '.[] | .ghcr_pkg' | sort -u | wc -l)"'}, | |
{host: "aarch64-Linux", total: '"$(curl -qfsSL 'https://meta.pkgforge.dev/bincache/aarch64-Linux.json' | jq -r '.[] | .ghcr_pkg' | sort -u | wc -l)"'} | |
] | . + [{"sum": "total", "total": (map(.total) | add)}]' | jq . > "${GITHUB_WORKSPACE}/main/bincache/data/TOTAL.json" | |
###Total (pkgcache) | |
#jq -n '[ | |
# {host: "x86_64-Linux", total: '"$(curl -qfsSL 'https://meta.pkgforge.dev/pkgcache/x86_64-Linux.json' | jq -r '.[] | .ghcr_pkg' | sort -u | wc -l)"'}, | |
# {host: "aarch64-Linux", total: '"$(curl -qfsSL 'https://meta.pkgforge.dev/pkgcache/aarch64-Linux.json' | jq -r '.[] | .ghcr_pkg' | sort -u | wc -l)"'} | |
#] | . + [{"sum": "total", "total": (map(.total) | add)}]' | jq . > "${GITHUB_WORKSPACE}/main/pkgcache/data/TOTAL.json" | |
##Total (soarpkgs) | |
jq -n '[ | |
{type: "binaries", total: '"$(curl -qfsSL 'https://meta.pkgforge.dev/soarpkgs/INDEX.json' | jq -r '.[] | select(.build_script | contains("binaries")) | .pkg' | wc -l)"'}, | |
{type: "packages", total: '"$(curl -qfsSL 'https://meta.pkgforge.dev/soarpkgs/INDEX.json' | jq -r '.[] | select(.build_script | contains("packages")) | .pkg' | wc -l)"'} | |
] | . + [{"sum": "total", "total": (map(.total) | add)}]' | jq . > "${GITHUB_WORKSPACE}/main/soarpkgs/data/TOTAL.json" | |
##Gif | |
cd "${GITHUB_WORKSPACE}/main" | |
sed -E "s~(https://bin\.pkgforge\.dev/list\.gif)[^\"]*~\1?$(basename "$(mktemp -u)")=$(basename "$(mktemp -u)")~g" -i "${GITHUB_WORKSPACE}/main/README.md" | |
continue-on-error: true | |
- name: Get DateTime & Purge files (=> 95 MB) | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
UTC_TIME="$(TZ='UTC' date +'%Y-%m-%d (%I:%M:%S %p)')" | |
echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}" | |
#Sync | |
cd "${GITHUB_WORKSPACE}/main" | |
git pull origin main --no-edit 2>/dev/null | |
#Purge | |
find "${GITHUB_WORKSPACE}/main" -path "${GITHUB_WORKSPACE}/main/.git" -prune -o -type f -size +95M -exec rm -rvf "{}" + 2>/dev/null | |
continue-on-error: true | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
repository: ./main | |
commit_user_name: Azathothas | |
commit_user_email: [email protected] | |
#commit_message: " " | |
commit_message: "✅ Healthchecks" | |
#push_options: '--force' | |
continue-on-error: true | |
- name: rClone BackUp Repo ("https://pub.ajam.dev/repos/${GITHUB_REPOSITORY}") | |
run: | | |
# Presets | |
set +x ; set +e | |
#--------------# | |
#copy & chdir to Repo | |
cp -fr "${GITHUB_WORKSPACE}/main" "${SYSTMP}/REPO" && cd "${SYSTMP}/REPO" | |
#Git pull | |
git pull origin main --no-edit 2>/dev/null | |
#Del Bloat | |
rm -rf "$(pwd)/.git" | |
#Upload to Pub | |
echo -e "[+] Syncing ${GITHUB_REPOSITORY} to pub.ajam.dev/repos/${GITHUB_REPOSITORY} \n" | |
rclone sync "." "r2:/pub/repos/${GITHUB_REPOSITORY}/" --user-agent="${USER_AGENT}" --buffer-size="10M" --s3-upload-concurrency="50" --s3-chunk-size="10M" --multi-thread-streams="50" --checkers="2000" --transfers="100" --retries="10" --check-first --checksum --copy-links --fast-list --progress | |
continue-on-error: true |