Skip to content

Commit

Permalink
dynamically update pkg counts
Browse files Browse the repository at this point in the history
  • Loading branch information
Azathothas authored Dec 8, 2024
1 parent 8a937ea commit 8c77aca
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/healthchecks_housekeeping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,42 @@ jobs:
find "${GITHUB_WORKSPACE}/main" -type f -name "*.md" -not -path '*/.*' -print0 | xargs -0 sed -i -E "s~(https://bin\.pkgforge\.dev/list\.gif)[^\"]*~\1?$(basename "$(mktemp -u)")=$(basename "$(mktemp -u)")~g"
continue-on-error: true

- name: Update (https://docs.pkgforge.dev/soar/comparisons/packages)
run: |
#Presets
set +x ; set +e
#--------------#
cd "${GITHUB_WORKSPACE}/main"
#https://github.com/ivan-hc/AM/tree/main/programs
AM_PKGNUM="$(curl -qfsSL "https://raw.githubusercontent.com/ivan-hc/AM/refs/heads/main/programs/x86_64-apps" | sort -u | wc -l | tr -d '[:space:]')"
if [ "${AM_PKGNUM}" -gt 2000 ]; then
sed -E "s/(<td>)[0-9]+(<\/td>)/\1${AM_PKGNUM}\2/" -i "${GITHUB_WORKSPACE}/main/soar/comparisons/packages.md"
fi
#https://formulae.brew.sh/docs/api/
BREW_PKGNUM="$(curl -qfsSL "https://formulae.brew.sh/api/formula.json" | jq -r '.[] | .name' | sort -u | wc -l | tr -d '[:space:]')"
if [ "${BREW_PKGNUM}" -gt 7000 ]; then
sed -E "s/(<td>[0-9]+<\/td><td>)[0-9]+(<\/td>)/\1${BREW_PKGNUM}\2/" -i "${GITHUB_WORKSPACE}/main/soar/comparisons/packages.md"
fi
#https://github.com/pacstall/pacstall-programs/tree/master/packages
PACSTALL_PKGNUM="$(curl -qfsSL "https://api.gh.pkgforge.dev/repos/pacstall/pacstall-programs/contents/packages" | jq -r '.[] | select(.type == "dir") | .name' | sort -u | wc -l | tr -d '[:space:]')"
if [ "${PACSTALL_PKGNUM}" -gt 600 ]; then
sed -E "s/(<td>[0-9]+<\/td><td>[0-9]+<\/td><td>)[0-9]+(<\/td>)/\1${PACSTALL_PKGNUM}\2/" -i "${GITHUB_WORKSPACE}/main/soar/comparisons/packages.md"
fi
#https://github.com/leleliu008/ppkg-formula-repository-official-core/tree/master/formula
PPKG_PKGNUM="$(curl -qfsSL "https://api.gh.pkgforge.dev/repos/leleliu008/ppkg-formula-repository-official-core/contents/formula" | jq -r '.[] | select(.type == "file") | .name' | grep -Ei '\.(yml|yaml)$' | sort -u | wc -l | tr -d '[:space:]')"
if [ "${PACSTALL_PKGNUM}" -gt 1000 ]; then
sed -E "s/(<td>[0-9]+<\/td><td>[0-9]+<\/td><td>[0-9]+<\/td><td>)[0-9]+(<\/td>)/\1${PPKG_PKGNUM}\2/" -i "${GITHUB_WORKSPACE}/main/soar/comparisons/packages.md"
fi
##https://docs.pkgforge.dev/repositories/pkgforge-edge/metadata
CACHE_PKG_NUM="$(curl -qfsSL "https://bin.pkgforge.dev/x86_64/METADATA.AIO.json" | jq -r '(.base[], .bin[], .pkg[]) | .pkg' | wc -l | tr -d '[:space:]')"
#https://docs.pkgforge.dev/repositories/pkgforge-community/metadata
SBUILD_PKG_NUM="$(curl -qfsSL "https://soarpkgs.pkgforge.dev/metadata/METADATA.json" | jq -r '.[] | .pkg' | wc -l | tr -d '[:space:]')"
PKG_NUM="$((CACHE_PKG_NUM + SBUILD_PKG_NUM))"
if [ "${PKG_NUM}" -gt 4000 ]; then
sed -E "s/(<td>[0-9]+<\/td><td>[0-9]+<\/td><td>[0-9]+<\/td><td>[0-9]+<\/td><td>)[0-9]+(<\/td>)/\1${PKG_NUM}\2/" -i "${GITHUB_WORKSPACE}/main/soar/comparisons/packages.md"
fi
continue-on-error: true

- uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ./main
Expand Down

0 comments on commit 8c77aca

Please sign in to comment.