Skip to content

Commit 34da01d

Browse files
committed
Preserve github workflows
1 parent 89125f2 commit 34da01d

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)