Skip to content

Commit a15356e

Browse files
committed
ci: 配信元ブランチを main から自動同期し、URL の生死を毎日確かめる
配信元の切替で privacy-policy/ が付いてこず、Play 申告済み URL が全滅した 事故 (2026-08-22) の再発防止。人手で2ブランチを揃える運用は必ず破綻する。
1 parent 4d7b2f3 commit a15356e

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# GitHub Pages の配信元 (pages-blank) を main から自動で組み立てる。
2+
#
3+
# 2026-08-22: 配信元を pages-blank に切り替えた際 privacy-policy/ を持ち込まなかった
4+
# ため、Play Console に申告済みの全 URL が 404 になり、ポリシー違反通知が届いた。
5+
# ファイルは main に残っていたので「存在する=配信されている」と取り違えられた。
6+
# 人手で2ブランチを揃える運用は同じ事故を必ず繰り返すので、機械で揃える。
7+
name: sync pages-blank
8+
9+
on:
10+
push:
11+
branches: [main]
12+
paths: ['privacy-policy/**', 'support/**', '.github/workflows/sync-pages-blank.yml']
13+
schedule:
14+
- cron: '17 3 * * *' # 毎日、配信状態そのものを見張る
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: write
19+
20+
jobs:
21+
sync:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
with: { ref: main, fetch-depth: 0 }
26+
27+
- name: pages-blank を組み立て直す
28+
run: |
29+
set -euo pipefail
30+
git config user.name "github-actions[bot]"
31+
git config user.email "github-actions[bot]@users.noreply.github.com"
32+
# 集約先は appdevelopsk.com のままにしたいので、ルートは転送スタブ、
33+
# 法務ページは canonical(.com) + noindex で配信する。
34+
tmp=$(mktemp -d); cp -R privacy-policy support "$tmp/"
35+
git checkout pages-blank
36+
rm -rf privacy-policy support
37+
cp -R "$tmp/privacy-policy" "$tmp/support" .
38+
python3 - <<'PY'
39+
import pathlib
40+
for p in list(pathlib.Path('.').glob('privacy-policy/*/index.html')) + \
41+
list(pathlib.Path('.').glob('support/*/index.html')):
42+
s = p.read_text()
43+
if 'name="robots"' not in s:
44+
p.write_text(s.replace('<head>', '<head>\n<meta name="robots" content="noindex, follow">', 1))
45+
PY
46+
git add privacy-policy support
47+
git diff --cached --quiet || git commit -m "pages: main の privacy/support を配信元へ同期"
48+
git push origin pages-blank
49+
50+
- name: 申告先 URL が実際に 200 か確かめる
51+
run: |
52+
set -euo pipefail
53+
sleep 60 # Pages のビルド待ち
54+
fail=0
55+
for d in privacy-policy/*/ support/*/; do
56+
c=$(curl -s -o /dev/null -w '%{http_code}' "https://appdevelopsk.github.io/$d")
57+
[ "$c" = 200 ] || { echo "NG $c $d"; fail=$((fail+1)); }
58+
done
59+
echo "404: $fail 件"
60+
[ "$fail" -eq 0 ]

0 commit comments

Comments
 (0)