-
Notifications
You must be signed in to change notification settings - Fork 126
133 lines (106 loc) · 4.62 KB
/
Copy pathclean-site.yml
File metadata and controls
133 lines (106 loc) · 4.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Cleanup iotdb-website Repository
on:
workflow_dispatch:
inputs:
target_branch:
description: 'Branch to cleanup (asf-site or asf-staging)'
required: true
type: choice
options:
- asf-site
- asf-staging
- both
confirm:
description: 'Type "CONFIRM" to proceed with cleanup'
required: true
type: string
jobs:
cleanup:
runs-on: ubuntu-latest
if: github.event.inputs.confirm == 'CONFIRM'
steps:
- name: Validate confirmation
if: github.event.inputs.confirm != 'CONFIRM'
run: |
echo "❌ Cleanup cancelled: confirmation not provided"
exit 1
- name: Setup SSH
env:
SSH_KEY: ${{ secrets.IOTDB_WEBSITE_BUILD_SSH }}
run: |
mkdir -p ~/.ssh
echo "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- name: Checkout iotdb-website repository
run: |
git clone --bare git@github.com:apache/iotdb-website.git
cd iotdb-website.git
for branch in asf-site asf-staging; do
git branch -r | grep $branch > /dev/null && echo "Branch $branch exists"
done
cd ..
git clone git@github.com:apache/iotdb-website.git
cd iotdb-website
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply. github.com"
- name: Cleanup asf-site branch
if: github.event. inputs.target_branch == 'asf-site' || github.event.inputs.target_branch == 'both'
run: |
echo "🧹 Cleaning up asf-site branch..."
# Checkout the branch
git checkout asf-site
# Create a new orphan branch (no history)
git checkout --orphan asf-site-new
# Add all current files
git add -A
# Create initial commit
git commit -m "chore: reset repository history to reduce size
Previous repository size: ~5.9GB
This commit resets the Git history to start fresh.
Ref: Repository cleanup initiative"
# Delete old branch and rename new one
git branch -D asf-site || true
git branch -m asf-site
# Force push (this removes all history)
git push -f origin asf-site
echo "✅ asf-site branch cleaned successfully"
- name: Cleanup asf-staging branch
if: github.event.inputs.target_branch == 'asf-staging' || github.event.inputs.target_branch == 'both'
run: |
echo "🧹 Cleaning up asf-staging branch..."
# Fetch and checkout the staging branch
git fetch origin asf-staging: asf-staging
git checkout asf-staging
# Create a new orphan branch (no history)
git checkout --orphan asf-staging-new
# Add all current files
git add -A
# Create initial commit
git commit -m "chore: reset repository history to reduce size
Previous repository size: ~5.9GB
This commit resets the Git history to start fresh.
Ref: Repository cleanup initiative"
# Delete old branch and rename new one
git branch -D asf-staging || true
git branch -m asf-staging
# Force push (this removes all history)
git push -f origin asf-staging
echo "✅ asf-staging branch cleaned successfully"
- name: Summary
run: |
echo "## Cleanup Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Successfully cleaned branch(es): **${{ github.event.inputs.target_branch }}**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps" >> $GITHUB_STEP_SUMMARY
echo "1. Wait for GitHub to run garbage collection (may take hours)" >> $GITHUB_STEP_SUMMARY
echo "2. Check repository size at: https://github.com/apache/iotdb-website" >> $GITHUB_STEP_SUMMARY
echo "3. All users should re-clone the repository to get the cleaned version" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### ⚠️ Important Notes" >> $GITHUB_STEP_SUMMARY
echo "- All commit history in the cleaned branch(es) has been removed" >> $GITHUB_STEP_SUMMARY
echo "- The repository size reduction may take some time to reflect on GitHub" >> $GITHUB_STEP_SUMMARY
echo "- Current deployments are not affected and will continue to work" >> $GITHUB_STEP_SUMMARY