|
name: Keep caches warm |
|
|
|
# **What it does**: |
|
# Makes sure the caching of ./node_modules and ./.next is kept warm |
|
# for making other pull requests faster. |
|
# We also use this workflow to precompute other things so that the |
|
# actions cache is warmed up with data available during deployment |
|
# actions. When you use actions/cache within a run on `main` |
|
# what gets saved can be used by other pull requests. But it's |
|
# also so that when we make production deployments, |
|
# we can just rely on the cache to already be warmed up. |
|
# **Why we have it**: |
|
# A PR workflow that depends on caching can't reuse a |
|
# cached artifact acorss PRs unless it also runs on `main`. |
|
# **Who does it impact**: Docs engineering, open-source engineering contributors. |
|
|
|
on: |
|
workflow_dispatch: |
|
push: |
|
branches: |
|
- main |
|
|
|
permissions: |
|
contents: read |
|
|
|
jobs: |
|
keep-caches-warm: |
|
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs' |
|
runs-on: ubuntu-latest |
|
steps: |
|
- name: Check out repo |
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
|
- name: Generate GitHub App token |
|
id: app-token |
|
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 |
|
with: |
|
app-id: ${{ secrets.DOCS_BOT_APP_ID }} |
|
private-key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }} |
|
owner: github |
|
repositories: docs-engineering |
|
|
|
- uses: ./.github/actions/node-npm-setup |
|
|
|
- uses: ./.github/actions/cache-nextjs |
|
|
|
- name: Build |
|
run: npm run build |
|
|
|
- uses: ./.github/actions/warmup-remotejson-cache |
|
if: github.repository == 'github/docs-internal' |
|
|
|
- uses: ./.github/actions/precompute-pageinfo |
|
if: github.repository == 'github/docs-internal' |
|
|
|
- uses: ./.github/actions/slack-alert |
|
if: ${{ failure() && github.event_name != 'workflow_dispatch' }} |
|
with: |
|
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }} |
|
|
|
- uses: ./.github/actions/create-workflow-failure-issue |
|
if: ${{ failure() && github.event_name != 'workflow_dispatch' }} |
|
with: |
|
token: ${{ steps.app-token.outputs.token }} |