mirror of
https://github.com/SukkaW/Surge.git
synced 2026-06-14 11:41:49 +08:00
CI: enable archive and toggle visibility
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled
Build / Remove Artifacts after Deployment (push) Has been cancelled
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled
Build / Remove Artifacts after Deployment (push) Has been cancelled
This commit is contained in:
68
.github/workflows/toggle-dist-repo-visibility.yml
vendored
Normal file
68
.github/workflows/toggle-dist-repo-visibility.yml
vendored
Normal file
@@ -0,0 +1,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
|
||||
Reference in New Issue
Block a user