96 lines
4.0 KiB
YAML
96 lines
4.0 KiB
YAML
name: Enterprise date updater
|
|
|
|
# **What it does**: Runs on a schedule to update lib/enterprise-dates.json.
|
|
# **Why we have it**: The lib/enterprise-dates.json file needs to be up-to-date
|
|
# for the .github/workflows/open-enterprise-issue.yml workflow and the
|
|
# tests/content/search.js test.
|
|
# **Who does it impact**: Docs engineering, docs content.
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '20 16 * * 2' # Run every Tuesday at 16:20 UTC / 8:20 PST
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
# **IMPORTANT:** Do not change the FREEZE environment variable set here!
|
|
# This workflow runs on a recurring basis. To temporarily disable it (e.g.,
|
|
# during a docs deployment freeze), add an Actions Secret to the repo settings
|
|
# called `FREEZE` with a value of `true`. To re-enable updates, simply
|
|
# delete that Secret from the repo settings. The environment variable here
|
|
# will duplicate that Secret's value for later evaluation.
|
|
env:
|
|
FREEZE: ${{ secrets.FREEZE }}
|
|
|
|
jobs:
|
|
open_enterprise_issue:
|
|
name: Enterprise date updater
|
|
if: github.repository == 'github/docs-internal'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- if: ${{ env.FREEZE == 'true' }}
|
|
run: |
|
|
echo 'The repo is currently frozen! Exiting this workflow.'
|
|
exit 1 # prevents further steps from running
|
|
|
|
- name: Checkout repository code
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
|
|
|
- uses: ./.github/actions/node-npm-setup
|
|
|
|
- name: Run script/update-enterprise-dates.js
|
|
run: |
|
|
script/update-enterprise-dates.js
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_FR }}
|
|
|
|
- name: Create pull request
|
|
id: create-pull-request
|
|
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04
|
|
env:
|
|
# Disable pre-commit hooks; they don't play nicely here
|
|
HUSKY: '0'
|
|
with:
|
|
# need to use a token with repo and workflow scopes for this step
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
commit-message: '🤖 ran script/update-enterprise-dates.js'
|
|
title: 🤖 lib/enterprise-dates.json update
|
|
body:
|
|
"Hello! The GitHub Enterprise Server release dates have changed.\n\n
|
|
If CI passes, this PR will be auto-merged. :green_heart:\n\n
|
|
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`. 🧶"
|
|
branch: enterprise-server-dates-update
|
|
delete-branch: true
|
|
|
|
- name: Enable GitHub auto-merge
|
|
if: ${{ steps.create-pull-request.outputs.pull-request-number }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
|
|
AUTOMERGE_PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }}
|
|
run: node .github/actions-scripts/enable-automerge.js
|
|
|
|
- if: ${{ failure() && env.FREEZE != 'true' }}
|
|
name: Delete remote branch (if previous steps failed)
|
|
uses: dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
branches: enterprise-server-dates-update
|
|
|
|
- if: ${{ steps.create-pull-request.outputs.pull-request-number }}
|
|
name: Approve
|
|
uses: juliangruber/approve-pull-request-action@c67a4808d52e44ea03656f6646ba24a010304f03
|
|
with:
|
|
github-token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
|
number: ${{ steps.create-pull-request.outputs.pull-request-number }}
|
|
|
|
- name: Send Slack notification if workflow fails
|
|
uses: someimportantcompany/github-actions-slack-message@1d367080235edfa53df415bd8e0bbab480f29bad
|
|
if: ${{ failure() && env.FREEZE != 'true' }}
|
|
with:
|
|
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
|
|
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
|
|
color: failure
|
|
text: The last enterprise-dates run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/enterprise-dates.yml
|