Skip to content

Commit 0b99eb9

Browse files
authored
[Localization] Short-circuit Crowdin Sync if it runs for more than 5 hours (github#22406)
* feat: set timeout and notifier for Crowdinn Sync * feat: emit a notification if Crowdin Sync fails
1 parent 47ba71c commit 0b99eb9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/crowdin.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
name: Sync with Crowdin
1515
if: github.repository == 'github/docs-internal'
1616
runs-on: ubuntu-latest
17+
# A sync's average run time is ~3.2 hours.
18+
# This sets a maximum execution time of 300 minutes (5 hours) to prevent the workflow from running longer than necessary.
19+
timeout-minutes: 300
1720
steps:
1821
- name: Checkout
1922
uses: actions/checkout@1e204e9a9253d643386038d443f96446fa156a97
@@ -59,3 +62,24 @@ jobs:
5962
# See https://crowdin.com/settings#api-key to generate a token
6063
# This token was created by logging into Crowdin with the octoglot user
6164
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
65+
66+
# When the maximum execution time is reached for this job, Actions cancels the workflow run.
67+
# This emits a notification for the first responder to triage.
68+
- name: Send Slack notification if workflow is cancelled
69+
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
70+
if: cancelled()
71+
with:
72+
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
73+
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
74+
color: failure
75+
text: The last Crowdin Sync run for ${{github.repository}} was cancelled. Please try running the workflow manually; see https://github.com/${{github.repository}}/actions/workflows/crowdin.yml
76+
77+
# Emit a notification for the first responder to triage if the workflow failed.
78+
- name: Send Slack notification if workflow failed
79+
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
80+
if: failure()
81+
with:
82+
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
83+
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
84+
color: failure
85+
text: The last Crowdin Sync run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/crowdin.yml

0 commit comments

Comments
 (0)