@@ -9,6 +9,10 @@ name: Purge Fastly
99
1010on :
1111 deployment_status :
12+ schedule :
13+ # Daily soft purge of all languages to catch reusables and AUTOTITLE links.
14+ # Intentionally off-peak, around 6-7pm PT.
15+ - cron : ' 20 2 * * *'
1216 workflow_dispatch :
1317 inputs :
1418 languages :
5862 - name : Check out repo
5963 uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
6064
65+ - name : Generate GitHub App token
66+ # Lets a scheduled-run failure open a tracking issue in docs-engineering
67+ # (the default GITHUB_TOKEN can't write cross-repo).
68+ id : app-token
69+ uses : actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
70+ with :
71+ app-id : ${{ secrets.DOCS_BOT_APP_ID }}
72+ private-key : ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}
73+ owner : github
74+ repositories : docs-engineering
75+
6176 - uses : ./.github/actions/node-npm-setup
6277
6378 - name : Validate confirmation input
7691
7792 - name : Purge Fastly
7893 # Auto post-deploy runs wait for the build, purge English only (temporary),
79- # and stay soft. A manual run uses the inputs: blank languages = all, the
80- # `hard` toggle, or a confirmed full-cache purge.
94+ # and stay soft. The daily scheduled run waits for nothing, purges all
95+ # languages (blank = all), and stays soft. A manual run uses the inputs:
96+ # blank languages = all, the `hard` toggle, or a confirmed full-cache purge.
8197 #
8298 # Raw inputs are passed through the environment and quoted, never spliced
8399 # into the command string, so a value like `en' --everything` can't break
@@ -89,10 +105,8 @@ jobs:
89105 EVERYTHING_INPUT : ${{ inputs.everything }}
90106 run : |
91107 args=()
92- if [ "$EVENT_NAME" != "workflow_dispatch" ]; then
93- args+=(--wait-for-build)
94- fi
95108 if [ "$EVENT_NAME" = "deployment_status" ]; then
109+ args+=(--wait-for-build)
96110 args+=(--languages en)
97111 elif [ -n "$LANGUAGES_INPUT" ]; then
98112 args+=(--languages "$LANGUAGES_INPUT")
@@ -123,3 +137,8 @@ jobs:
123137 if : ${{ failure() && github.event_name != 'workflow_dispatch' }}
124138 with :
125139 slack_token : ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
140+
141+ - uses : ./.github/actions/create-workflow-failure-issue
142+ if : ${{ failure() && github.event_name != 'workflow_dispatch' }}
143+ with :
144+ token : ${{ steps.app-token.outputs.token }}
0 commit comments