Skip to content

Commit bbd21bc

Browse files
authored
add workflow to run script/update-enterprise-dates.js weekly (github#19075)
1 parent fc8cf4f commit bbd21bc

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Enterprise date updater
2+
3+
# **What it does**: Runs on a schedule to update lib/enterprise-dates.json.
4+
# **Why we have it**: The lib/enterprise-dates.json file needs to be up-to-date
5+
# for the .github/workflows/open-enterprise-issue.yml workflow and the
6+
# tests/content/algolia-search.js test.
7+
# **Who does it impact**: Docs engineering, docs content.
8+
9+
on:
10+
workflow_dispatch:
11+
schedule:
12+
- cron: '39 2 * * 2' # At 02:39 on Tuesday
13+
14+
# **IMPORTANT:** Do not change the FREEZE environment variable set here!
15+
# This workflow runs on a recurring basis. To temporarily disable it (e.g.,
16+
# during a docs deployment freeze), add an Actions Secret to the repo settings
17+
# called `FREEZE` with a value of `true`. To re-enable updates, simply
18+
# delete that Secret from the repo settings. The environment variable here
19+
# will duplicate that Secret's value for later evaluation.
20+
env:
21+
FREEZE: ${{ secrets.FREEZE }}
22+
23+
jobs:
24+
open_enterprise_issue:
25+
name: Enterprise date updater
26+
if: github.repository == 'github/docs-internal'
27+
runs-on: ubuntu-latest
28+
steps:
29+
- if: ${{ env.FREEZE == 'true' }}
30+
run: |
31+
echo 'The repo is currently frozen! Exiting this workflow.'
32+
exit 1 # prevents further steps from running
33+
- name: Run script/update-enterprise-dates.js
34+
run: |
35+
script/update-enterprise-dates.js
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Create pull request
39+
id: create-pull-request
40+
uses: peter-evans/create-pull-request@8c603dbb04b917a9fc2dd991dc54fef54b640b43
41+
with:
42+
# need to use a token with repo and workflow scopes for this step
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
commit-message: '🤖 ran script/update-enterprise-dates.js'
45+
title: 🤖 lib/enterprise-dates.json update
46+
body:
47+
"Hello! The GitHub Enterprise Server release dates have changed.\n\n
48+
If CI passes, this PR will be auto-merged. :green_heart:\n\n
49+
If CI does not pass or other problems arise, contact #docs-engineering on slack.\n\nThis PR was 🤖-crafted by `.github/workflows/enterprise-dates.yml`. 🧶"
50+
labels: automerge,autoupdate
51+
branch: enterprise-server-dates-update
52+
delete-branch: true
53+
- if: ${{ failure() }}
54+
name: Delete remote branch (if previous steps failed)
55+
uses: dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911
56+
with:
57+
github_token: ${{ secrets.GITHUB_TOKEN }}
58+
branches: enterprise-server-dates-update
59+
- if: ${{ steps.create-pull-request.outputs.pull-request-number }}
60+
name: Approve
61+
uses: juliangruber/approve-pull-request-action@c530832d4d346c597332e20e03605aa94fa150a8
62+
with:
63+
github-token: ${{ secrets.DOCUBOT_REPO_PAT }}
64+
number: ${{ steps.create-pull-request.outputs.pull-request-number }}
65+
- name: Send Slack notification if workflow fails
66+
uses: someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd
67+
if: failure()
68+
with:
69+
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
70+
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
71+
color: failure
72+
text: The last enterprise-dates run for ${{github.repository}} failed. See https://github.com/github/${{github.repository}}/actions/workflows/enterprise-dates.yml

0 commit comments

Comments
 (0)