-
Notifications
You must be signed in to change notification settings - Fork 64
59 lines (56 loc) · 1.49 KB
/
close_issues_and_pulls.yaml
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
name: reset_exercises
on:
workflow_dispatch:
permissions: write-all
jobs:
close-pulls:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- run: |
for p in $(gh pr list --json number --jq '.[].number'); do
gh pr close $p
done
close-issues:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- run: |
for p in $(gh issue list --limit 200 --json number --jq '.[].number'); do
gh issue close $p
done
reset-branches:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: |
for b in $(git branch -r); do
if [[ $b != origin/main ]] && [[ $b != *backup* ]]; then
b=${b/origin\//}
git push origin --delete "$b"
git checkout backup-"$b"
git checkout -b "$b" "backup-""$b"
git push -f origin "$b"
fi
done
reset-main:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: |
git config user.name github-actions
git config user.email "[email protected]"
git reset --hard beginning
git push -f origin main