1
0
mirror of synced 2026-01-06 06:02:35 -05:00

Hello git history spelunker!

Are you looking for something? Here is all of the GitHub Docs history in one single commit. Enjoy! 🎉
This commit is contained in:
Vanessa Yuen
2020-09-27 14:10:11 +02:00
parent fa8bb2322f
commit 3df90fc9b8
28386 changed files with 1723440 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
name: 60 Days Stale Check
on:
schedule:
- cron: "40 16 * * *" # Run each day at 16:40 UTC / 8:40 PST
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity.'
stale-pr-message: 'This PR is stale because it has been open 60 days with no activity.'
days-before-stale: 60
days-before-close: -1
only-labels: 'engineering'
stale-issue-label: 'stale'
stale-pr-label: 'stale'

12
.github/workflows/auto-label-prs.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
name: Auto label Pull Requests
on:
- pull_request
jobs:
triage:
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

37
.github/workflows/automerge.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: automerge
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
types:
- submitted
check_suite:
types:
- completed
status: {}
jobs:
automerge:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'automerge')
steps:
- name: automerge
uses: "pascalgn/automerge-action@135f0bdb927d9807b5446f7ca9ecc2c51de03c4a"
env:
GITHUB_TOKEN: "${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}"
MERGE_LABELS: "automerge"
MERGE_REMOVE_LABELS: ""
MERGE_COMMIT_MESSAGE: "pull-request-title"
MERGE_METHOD: "merge"
MERGE_FORKS: "true"
MERGE_RETRIES: "50"
MERGE_RETRY_SLEEP: "10000"
UPDATE_LABELS: "automerge"
UPDATE_METHOD: "merge"

37
.github/workflows/autosquash.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: autosquash
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
types:
- submitted
check_suite:
types:
- completed
status: {}
jobs:
automerge:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'autosquash')
steps:
- name: autosquash
uses: "pascalgn/automerge-action@135f0bdb927d9807b5446f7ca9ecc2c51de03c4a"
env:
GITHUB_TOKEN: "${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}"
MERGE_LABELS: "autosquash"
MERGE_REMOVE_LABELS: ""
MERGE_COMMIT_MESSAGE: "pull-request-title"
MERGE_METHOD: "squash"
MERGE_FORKS: "true"
MERGE_RETRIES: "50"
MERGE_RETRY_SLEEP: "10000"
UPDATE_LABELS: "automerge"
UPDATE_METHOD: "merge"

16
.github/workflows/autoupdate-branch.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: autoupdate branch
on:
push:
branches:
- main
jobs:
autoupdate:
name: autoupdate
runs-on: ubuntu-18.04
steps:
- uses: docker://chinthakagodawita/autoupdate-action:v1
env:
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
PR_FILTER: labelled
PR_LABELS: autoupdate
MERGE_MSG: "Branch was updated using the 'autoupdate branch' Actions workflow."

18
.github/workflows/browser-test.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Browser Tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install
uses: ianwalter/puppeteer@3.0.0
with:
args: npm ci
- name: Test
uses: ianwalter/puppeteer@3.0.0
with:
args: npm run browser-test

View File

@@ -0,0 +1,36 @@
name: Check all English links
on:
schedule:
- cron: "40 19 * * *" # once a day at 19:40 UTC / 11:40 PST
jobs:
check_all_english_links:
name: Check all links
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: npm ci
run: npm ci
- name: npm run build
run: npm run build
- name: Run script
run: script/check-external-links en > broken_links.md
- name: Check if any broken links
id: check
run: |
if [ "$(grep 'All links are good' broken_links.md)" ]; then
echo ::set-output name=continue::no
else
echo "::set-output name=continue::yes"
echo "::set-output name=title::$(grep 'found on help.github.com' broken_links.md)"
fi
- if: ${{ steps.check.outputs.continue == 'yes' }}
name: Create issue from file
uses: peter-evans/create-issue-from-file@v2
with:
token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
title: ${{ steps.check.outputs.title }}
content-filepath: ./broken_links.md
labels: broken link report

23
.github/workflows/codeql.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: "CodeQL analysis"
on:
push:
paths:
- '**/*.js'
- '.github/workflows/codeql.yml'
jobs:
build:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: github/codeql-action/init@v1
with:
languages: javascript # comma separated list of values from {go, python, javascript, java, cpp, csharp} (not YET ruby, sorry!)
- uses: github/codeql-action/analyze@v1
continue-on-error: true

View File

@@ -0,0 +1,23 @@
on:
pull_request:
types: ['closed']
jobs:
comment:
if: github.event.repository.private == false && github.event.pull_request.merged && github.event.pull_request.base.ref == github.event.repository.default_branch
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
script: |
github.issues.createComment({
...context.repo,
issue_number: context.payload.pull_request.number,
body: `Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. To add your ✨ contribution to the README.md, create a new comment in this PR with:
```
@all-contributors please add @${context.payload.pull_request.user.login} for docs
```
If you want to, you can use the [emoji key](https://allcontributors.org/docs/en/emoji-key) to replace docs with a different contribution type.`
})

30
.github/workflows/pa11y.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: "Pa11y"
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run build scripts
run: npm run build
- name: Run pa11y tests
run: npm run pa11y-test

21
.github/workflows/ping-staging-apps.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Ping staging apps
on:
schedule:
- cron: "*/20 * * * *" # every twenty minutes
jobs:
ping_staging_apps:
name: Ping
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
env:
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: npm ci
run: npm ci
- name: npm run build
run: npm run build
- name: Run script
run: script/ping-staging-apps.js

View File

@@ -0,0 +1,55 @@
name: Remove unused assets
env:
FREEZE: ${{ secrets.FREEZE }}
on:
schedule:
# - cron: "20 15 * * 0" # run every Sunday at 20:15 UTC / 12:15 PST
- cron: 0 0 1 1 * # run next January 1st, aka temporarily disabled
jobs:
remove_unused_assets:
name: Remove unused assets
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
uses: actions/checkout@v2
- name: npm ci
run: npm ci
- name: Run scripts
run: |
script/remove-unused-assets.js > results.md
script/remove-extraneous-translation-files.js
- name: Get script results to use in PR body
id: results
uses: juliangruber/read-file-action@v1
with:
path: ./results.md
- name: Remove script results file
run: rm -rf ./results.md
- name: Create pull request
uses: peter-evans/create-pull-request@v2
with:
# need to use a token with repo and workflow scopes for this step
token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
commit-message: Action ran script/remove-unused-assets.js
title: Remove unused assets
body: "Hello! This PR removes some files that exist in the repo but are not used in content or data files:\n\n
${{ steps.results.outputs.content }}
\n\nIf you have any questions, please contact @github/docs-engineering."
labels: unused assets
project: Core docs work for the current week
project-column: Should do
branch: remove-unused-assets
- if: ${{ failure() }}
name: Delete remote branch (if previous steps failed)
uses: dawidd6/action-delete-branch@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: remove-unused-assets

67
.github/workflows/repo-sync.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
name: Repo Sync
on:
schedule:
- cron: "*/15 * * * *" # every 15 minutes
env:
FREEZE: ${{ secrets.FREEZE }}
jobs:
repo-sync:
name: Repo Sync
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Exit if repo is frozen
if: ${{ env.FREEZE == 'true' }}
run: |
echo 'The repo is currently frozen! Exiting this workflow.'
exit 1 # prevents further steps from running
- name: Check out repo
uses: actions/checkout@v2
- name: Sync repo to branch
uses: repo-sync/github-sync@v2.1.0
env:
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
with:
source_repo: ${{ secrets.SOURCE_REPO }}
source_branch: main
destination_branch: repo-sync
github_token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
- name: Create pull request
uses: repo-sync/pull-request@v2
env:
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
with:
source_branch: repo-sync
destination_branch: main
pr_title: "repo sync"
pr_body: "This is an automated pull request to sync changes between the public and private docs repos.\n\n:robot: Please let a bot do the merging!"
pr_label: "automerge"
github_token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
- name: Find pull request
uses: juliangruber/find-pull-request-action@v1
id: find-pull-request
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: repo-sync
- name: Approve pull request
if: ${{ steps.find-pull-request.outputs.number }}
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.find-pull-request.outputs.number }}
- name: Send Slack notification if workflow fails
uses: rtCamp/action-slack-notify@master
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.DOCS_ALERTS_SLACK_WEBHOOK }}
SLACK_MESSAGE: The last repo-sync run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions?query=workflow%3A%22Repo+Sync%22

View File

@@ -0,0 +1,28 @@
name: Send Issue to EPD backlog
on:
issues:
types: [labeled, reopened]
jobs:
triage:
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Add issues with engineering label to project board
if: contains(github.event.issue.labels.*.name, 'engineering') || contains(github.event.issue.labels.*.name, 'design') || contains(github.event.issue.labels.*.name, 'Design')
uses: actions/github-script@v2
with:
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
script: |
var column_id = 9659080;
try {
github.projects.createCard({
column_id: column_id,
content_id: context.payload.issue.id,
content_type: "Issue"
});
} catch (error) {
console.log(error);
}

View File

@@ -0,0 +1,64 @@
name: Start new engineering PR workflow
on:
pull_request:
types: [opened, reopened]
jobs:
triage:
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
continue-on-error: true
env:
DRAFT_COLUMN_ID: 10095775
REGULAR_COLUMN_ID: 10095779
steps:
- name:
uses: actions/github-script@v2
with:
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
script: |
// Only assign the engineering folks
try {
await github.teams.getMembershipForUserInOrg({
org: 'github',
team_slug: 'docs-engineering',
username: context.payload.sender.login,
});
} catch(err) {
return
}
// Set column ID
const column_id = context.payload.pull_request.draft
? process.env.DRAFT_COLUMN_ID
: process.env.REGULAR_COLUMN_ID
// Try to create the card on the GitHub Project
try {
await github.projects.createCard({
column_id: column_id,
content_type: 'PullRequest',
content_id: context.payload.pull_request.id
});
} catch(error) {
console.log(error);
}
// Try to set the author as the assignee
const owner = context.payload.repository.owner.login
const repo = context.payload.repository.name
try {
await github.issues.addAssignees({
owner: owner,
repo: repo,
issue_number: context.payload.pull_request.number,
assignees: [
context.payload.sender.login
]
});
} catch(error) {
console.log(error);
}

View File

@@ -0,0 +1,39 @@
name: Algolia
on:
push:
branches:
- main
jobs:
updateIndices:
name: Update indices
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: npm ci
run: npm ci
- name: sync indices
env:
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run sync-search
- name: Send slack notification if workflow run fails
uses: rtCamp/action-slack-notify@v2.1.0
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.DOCS_ALERTS_SLACK_WEBHOOK }}
SLACK_MESSAGE: The last Algolia workflow run for ${{github.repository}} failed. See https://github.com/github/docs-internal/actions?query=workflow%3AAlgolia

79
.github/workflows/test-translations.yml vendored Normal file
View File

@@ -0,0 +1,79 @@
# NOTE: Changes to this file should also be applied to './test-windows.yml' and './test.yml'
name: Node.js Tests - Translations
on:
schedule:
- cron: "10 20 * * *" # once a day at 20:10 UTC / 12:10 PST
jobs:
lint:
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
with:
ref: translations # check out the 'translations' branch
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run linter
run: npx standard
- name: Check dependencies
run: npm run check-deps
test:
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-group: [content, meta, rendering, routing, unit, links-and-images]
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run tests
run: npx jest tests/${{ matrix.test-group }}/

83
.github/workflows/test-windows.yml vendored Normal file
View File

@@ -0,0 +1,83 @@
# NOTE: Changes to this file should also be applied to './test.yml' and './test-translations.yml'
name: Node.js Tests - Windows
on:
schedule:
- cron: "50 19 * * *" # once a day at 19:50 UTC / 11:50 PST
env:
CI: true
jobs:
lint:
if: github.repository == 'github/docs-internal'
runs-on: windows-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run linter
run: npx standard
- name: Check dependencies
run: npm run check-deps
test:
if: github.repository == 'github/docs-internal'
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
test-group: [content, meta, rendering, routing, unit, links-and-images]
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run build script
run: npm run build
- name: Run tests
run: npx jest tests/${{ matrix.test-group }}/

92
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,92 @@
# NOTE: Changes to this file should also be applied to './test-windows.yml' and './test-translations.yml'
name: Node.js Tests
on:
push:
branches:
- main
pull_request:
branches-ignore:
- translations
env:
CI: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run linter
run: npx standard
- name: Check dependencies
run: npm run check-deps
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-group: [content, meta, rendering, routing, unit, links-and-images]
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache node modules
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run build script
run: npm run build
- name: Run tests
run: npx jest tests/${{ matrix.test-group }}/
- name: Send Slack notification if workflow fails
uses: rtCamp/action-slack-notify@master
if: failure() && github.ref == 'early-access'
env:
SLACK_WEBHOOK: ${{ secrets.DOCS_ALERTS_SLACK_WEBHOOK }}
SLACK_MESSAGE: "Tests are failing on the `early-access` branch. https://github.com/github/docs-internal/tree/early-access"

56
.github/workflows/translations.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
name: Translations
on:
schedule:
- cron: "20 19 * * *" # once a day at 19:20 UTC / 11:20 PST
env:
FREEZE: ${{ secrets.FREEZE }}
jobs:
prepare:
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: Find original Pull Request
uses: juliangruber/find-pull-request-action@v1
id: pr
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
branch: translations
- if: ${{ steps.pr.outputs.number }}
name: Check if already labeled
uses: actions/github-script@0.9.0
id: has-label
with:
script: |
const { data: labels } = await github.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ steps.pr.outputs.number }}
})
if (labels.find(label => label.name === 'automerge')) {
return 'ok'
}
- if: ${{ !steps.has-label.outputs.result }}
name: Approve Pull Request
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.pr.outputs.number }}
- if: ${{ !steps.has-label.outputs.result }}
name: Add automerge label
uses: actions/github-script@0.9.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ steps.pr.outputs.number }},
labels: ['automerge']
})

View File

@@ -0,0 +1,72 @@
name: Update GraphQL files
# **IMPORTANT:** Do not change the FREEZE environment variable set here.
# This workflow runs every hour. To temporarily disable it (for example, during
# a docs freeze), add a secret to the docs repo settings called `FREEZE`
# with a value of `true`. To reenable GraphQL updates, delete the secret in
# the repo settings. The env variable here will evaluate whether the secret exists.
env:
FREEZE: ${{ secrets.FREEZE }}
on:
schedule:
- cron: "20 16 * * *" # run every day at 16:20 UTC / 8:20 PST
jobs:
update_graphql_files:
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
uses: actions/checkout@v2
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.4'
- name: Install Ruby dependencies
run: |
gem install bundler
bundle install
- name: Install Node.js dependencies
run: npm ci
- name: Run updater scripts
env:
# need to use a token from a user with access to github/github for this step
GITHUB_TOKEN: ${{ secrets.ZEKE_PAT_WITH_REPO_AND_WORKFLOW_SCOPE_FOR_REPO_SYNC }}
# technically the changelog should only be updated once per day, but we can safely
# run build-changelog-from-markdown.js in its current form once per hour; when we
# rewrite the changelog script, we may need to run it in a separate workflow on a
# once-per-day schedule; see details in https://github.com/github/docs-internal/issues/12722.
run: |
script/graphql/update-files.js
script/graphql/build-changelog-from-markdown.js
- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@v2
with:
# need to use a token with repo and workflow scopes for this step
token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
commit-message: 'Action ran graphql scripts "update-files" and "build-changelog-from-markdown"'
title: GraphQL schema update
body: "Hello! Some GraphQL data in github/github was updated recently. This PR
syncs up the GraphQL data in this repo.\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."
labels: automerge
branch: graphql-schema-update
- if: ${{ failure() }}
name: Delete remote branch (if previous steps failed)
uses: dawidd6/action-delete-branch@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: graphql-schema-update
- if: ${{ steps.create-pull-request.outputs.pr_number }}
name: Approve
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.create-pull-request.outputs.pr_number }}