Skip to content

Commit

Permalink
delete lagacy gh-pages branches
Browse files Browse the repository at this point in the history
  • Loading branch information
SunSerega committed Apr 26, 2024
1 parent 1429f43 commit 4ac5f42
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/on commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ jobs:
git config --global user.name "sun pack bot"
git config --global user.email "[email protected]"
git config --global --add url.https://github.com/.insteadOf "[email protected]:"
git fetch origin
for branch in $(git branch -r | grep 'origin/gh-pages/'); do
branch_name=$(echo $branch | sed 's#origin/gh-pages/##')
echo "Testing legacy branch [$branch]"
if ! git branch -r | grep -q "origin/$branch_name"; then
echo "Deleting legacy branch [$branch]"
git push origin --delete $(echo $branch | sed 's#origin/##')
fi
done
branch_name="gh-pages/$(git rev-parse --abbrev-ref HEAD)"
git checkout --orphan "$branch_name"
Expand All @@ -35,7 +47,6 @@ jobs:
git add .
git commit -m "Split off gh-pages"
git fetch origin
if git show-ref --verify --quiet refs/remotes/origin/$branch_name; then
echo "Remote branch $branch_name found"
if [ -z "$( git diff "origin/$branch_name" )" ]; then
Expand Down

0 comments on commit 4ac5f42

Please sign in to comment.