forked from SukkaW/Surge
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtoggle-dist-repo-visibility.yml
More file actions
68 lines (62 loc) · 2.19 KB
/
Copy pathtoggle-dist-repo-visibility.yml
File metadata and controls
68 lines (62 loc) · 2.19 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
name: Toggle Dist Repo Visibility
on:
schedule:
# Runs at 22:47 UTC every Sunday
# This also avoids hitting our own auto build schedule at 05:17 and 17:17 UTC
- cron: '47 14 * * 0'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
toggle_dist_repo_visibility:
name: Toggle Dist Repo Visibility
runs-on: ubuntu-slim
steps:
- name: Make dist repo private
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
gh repo unarchive SukkaLab/ruleset.skk.moe --yes
gh repo edit SukkaLab/ruleset.skk.moe \
--visibility private \
--accept-visibility-change-consequences
- name: Wait for visibility change to settle
run: sleep 180
- name: Make dist repo public again
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
gh repo edit SukkaLab/ruleset.skk.moe \
--visibility public \
--accept-visibility-change-consequences
- name: Restore GitHub Pages branch deployment
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
# After we toggle the visibility, GitHub Pages WILL get taken down
# But just in case, we still detect and use both PUT/POST
run: |
if gh api repos/SukkaLab/ruleset.skk.moe/pages >/dev/null 2>&1; then
gh api \
--method PUT \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2026-03-10" \
repos/SukkaLab/ruleset.skk.moe/pages \
-f "build_type=legacy" \
-f "source[branch]=master" \
-f "source[path]=/"
else
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2026-03-10" \
repos/SukkaLab/ruleset.skk.moe/pages \
-f "build_type=legacy" \
-f "source[branch]=master" \
-f "source[path]=/"
fi
- name: Archive dist repo again
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
gh repo archive SukkaLab/ruleset.skk.moe --yes