File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+
2+ name : Force Reset While Preserving .github
3+
4+ on :
5+ workflow_dispatch : # You can trigger this manually
6+
7+ jobs :
8+ reset-job :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout repository
13+ uses : actions/checkout@v4
14+ with :
15+ fetch-depth : 0 # Needed for full history and reset
16+
17+ - name : Backup .github directory
18+ run : |
19+ echo "Backing up .github directory..."
20+ cp -r .github /tmp/github-backup
21+
22+ - name : Force reset to origin/main
23+ run : |
24+ echo "Resetting to origin/main..."
25+ git fetch origin
26+ git reset --hard origin/main
27+
28+ - name : Restore .github directory
29+ run : |
30+ echo "Restoring .github directory..."
31+ if [ -d /tmp/github-backup ]; then
32+ rm -rf .github
33+ cp -r /tmp/github-backup .github
34+ else
35+ echo "Backup not found. Skipping restore."
36+ fi
37+
38+ - name : Show final status
39+ run : |
40+ echo "Final git status:"
41+ git status
42+
You can’t perform that action at this time.
0 commit comments