Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
Azathothas committed Apr 17, 2024
1 parent 2679d49 commit 2d23f93
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/healthchecks_housekeeping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,35 @@ jobs:
echo '```' >> "$GITHUB_WORKSPACE/main/.github/SIZE.md"
continue-on-error: true

- name: Ensure Healthy Commit Nums (RESET ON >= 1000)
run: |
#Presets
set +x ; set +e
#--------------#
pushd "$(mktemp -d)" > /dev/null 2>&1 && git clone --filter="blob:none" "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
cd "$(find . -maxdepth 1 -type d -exec basename {} \; | grep -Ev '^\.$' | xargs -I {} realpath {})"
CLONED_DIR="$(realpath .)" && export CLONED_DIR="$CLONED_DIR"
COMMIT_NUMS="$(git rev-list --count HEAD)" && export COMMIT_NUMS="$COMMIT_NUMS"
popd > /dev/null 2>&1 ; rm -rf "$CLONED_DIR" 2>/dev/null
cd "$GITHUB_WORKSPACE/main"
if [ "$COMMIT_NUMS" -gt 1000 ]; then
echo -e "\n[+] Total number of commits exceeds 1000. ($COMMIT_NUMS)\n"
cd "$GITHUB_WORKSPACE/main"
git config "user.name" "Azathothas"
git config "user.email" "AjamX101@gmail.com"
git checkout --orphan temp
git add --all --verbose && git commit -m "Purge (Re:Init)"
git branch -D "main"
git branch -m "main"
git push --set-upstream origin main --force
echo "RESET_HISTORY=YES" >> "$GITHUB_ENV"
else
echo -e "\n[+] Total number of commits looks healthy. ($COMMIT_NUMS)\n"
echo "RESET_HISTORY=NO" >> "$GITHUB_ENV"
fi
pushd "$GITHUB_WORKSPACE/main" >/dev/null 2>&1 && git pull origin main && popd >/dev/null 2>&1
continue-on-error: true

- name: Get DateTime
run: |
# Date Time
Expand Down

0 comments on commit 2d23f93

Please sign in to comment.