This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2679d49
commit 2d23f93
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" "[email protected]" | ||
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 | ||
|