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