Skip to content

Commit faad60d

Browse files
committed
Preserve github workflows
1 parent 89125f2 commit faad60d

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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: # 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+

0 commit comments

Comments
 (0)