1
0
mirror of synced 2025-12-19 09:57:42 -05:00
Files
docs/.github/workflows/purge-fastly.yml
dependabot[bot] 3e333183fb Bump actions/checkout from 5.0.0 to 6.0.1 (#58937)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-16 23:37:47 +00:00

66 lines
2.4 KiB
YAML

name: Purge Fastly
# **What it does**: Sends a soft-purge to Fastly.
# **Why we have it**: So that, right after a production deploy, we start afresh
# **Who does it impact**: Writers and engineers.
on:
deployment_status:
workflow_dispatch:
inputs:
languages:
description: "Comma separated languages. E.g. 'en,es,ja,pt,zh,ru,fr,ko,de' (defaults to en)"
required: false
default: 'en' # Temporary, only purge English on deploy. Set to empty string for all
permissions:
contents: read
env:
FASTLY_TOKEN: ${{ secrets.FASTLY_TOKEN }}
FASTLY_SERVICE_ID: ${{ secrets.FASTLY_SERVICE_ID }}
jobs:
send-purges:
# Run when workflow_dispatch is the event (manual) or when deployment_status is the event (automatic) and it's a successful production deploy
if: >-
${{
github.repository == 'github/docs-internal' &&
(github.event_name != 'deployment_status' ||
github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'production')
}}
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/node-npm-setup
- name: Wait for production to match build number
run: |
needs=$(git rev-parse HEAD)
start_time=$(date +%s)
timeout_seconds=1200
while [[ $needs != $(curl -s --fail --retry-connrefused --retry 5 https://docs.github.com/_build) ]]
do
if [[ $(($(date +%s) - $start_time)) -gt $timeout_seconds ]]
then
echo "Production did not match the build number within $timeout_seconds seconds"
exit 1
fi
echo "Production is not up to date with the build commit"
sleep 10
done
echo "Production is up to date with the build commit"
- name: Purge Fastly edge cache per language
env:
LANGUAGES: ${{ inputs.languages || 'en' }} # Temporary, only purge English on deploy. Set to empty string for all
run: npm run purge-fastly-edge-cache-per-language
- uses: ./.github/actions/slack-alert
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
with:
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}