Skip to content

Enterprise date updater #2

Enterprise date updater

Enterprise date updater #2

name: Enterprise date updater
# **What it does**: Runs on a schedule to update
# src/ghes-releases/lib/enterprise-dates.json.
# **Why we have it**: The src/ghes-releases/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
jobs:
open_enterprise_issue:
name: Enterprise date updater
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- name: Checkout repository code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: ./.github/actions/node-npm-setup
- name: Run src/ghes-releases/scripts/update-enterprise-dates.js
run: |
src/ghes-releases/scripts/update-enterprise-dates.js
env:
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # pin @v6.0.0
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.DOCS_BOT_PAT_READPUBLICKEY }}
commit-message: '🤖 ran src/ghes-releases/scripts/update-enterprise-dates.js'
title: 🤖 src/ghes-releases/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.DOCS_BOT_PAT_READPUBLICKEY }}
AUTOMERGE_PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }}
run: node src/workflows/enable-automerge.js
- if: ${{ failure() }}
name: Delete remote branch (if previous steps failed)
run: git push origin --delete enterprise-server-dates-update
- if: ${{ steps.create-pull-request.outputs.pull-request-number }}
name: Approve
uses: juliangruber/approve-pull-request-action@dcc4effb325c0b503408619918d56e40653dcc91
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.create-pull-request.outputs.pull-request-number }}
- 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 }}