Skip to content

Commit 8a9e9d5

Browse files
Merge pull request #1788 from cpprefjp/build_github_token
build icons on page
2 parents b08b650 + 4ea1166 commit 8a9e9d5

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,24 @@ jobs:
134134
core.setOutput('repo_full', repo_full);
135135
core.setOutput('ubranch', encodeURIComponent(branch));
136136
137+
# 編集者アイコン表示用の「メールアドレス → GitHub アカウント名」キャッシュ。
138+
# site_generator は毎回新しくチェックアウトされるので、ビルド間で引き継ぐ。
139+
# キャッシュはイミュータブルなので run_id 付きのキーで毎回保存し、
140+
# 復元時は restore-keys で最新のものを使う。
141+
- name: Restore GitHub users cache
142+
uses: actions/cache/restore@v6
143+
with:
144+
path: site_generator/settings.cpprefjp.github_users.cache
145+
key: github-users-${{ github.run_id }}-${{ github.run_attempt }}
146+
restore-keys: github-users-
147+
137148
# あとはスクリプトで頑張る
138149
- name: Run script build.sh
139150
run: ../.trusted/.github/workflows/script/build.sh ${{ inputs.arguments }}
140151
env:
152+
# 編集者の GitHub アカウント名を GitHub API で引く際の認証に使う
153+
# (未認証だとレート制限が 60 リクエスト/時しかない)
154+
GITHUB_TOKEN: ${{ github.token }}
141155
base_git_url: ${{ github.event.pull_request.base.repo.clone_url }}
142156
base_git_ref: ${{ github.event.pull_request.base.ref }}
143157
commit_base: ${{ steps.preview_vars.outputs.sha0 }}
@@ -147,6 +161,14 @@ jobs:
147161
preview_ubranch: ${{ steps.preview_vars.outputs.ubranch }}
148162
working-directory: site_generator
149163

164+
# キャッシュの保存はデプロイ時のみ行う (PR のプレビュー生成では復元だけする)
165+
- name: "(Deploy) Save GitHub users cache"
166+
if: inputs.arguments == '' && !cancelled()
167+
uses: actions/cache/save@v6
168+
with:
169+
path: site_generator/settings.cpprefjp.github_users.cache
170+
key: github-users-${{ github.run_id }}-${{ github.run_attempt }}
171+
150172
# Preview 用
151173
- name: "(Preview build) Publish result in gh-pages"
152174
if: startsWith(inputs.arguments, '--pull ')

0 commit comments

Comments
 (0)