From 56f2e50aada3e139643c40477986c61c3f0f63aa Mon Sep 17 00:00:00 2001 From: Rachael Sewell Date: Mon, 1 May 2023 12:17:22 -0700 Subject: [PATCH] unify the directory and script names for graphql pipeline (#36756) --- .../{update-graphql-files.yml => sync-graphql.yml} | 6 +++--- src/ghes-releases/lib/release-steps.md | 2 +- src/graphql/README.md | 2 +- src/graphql/data/{dotcom => fpt}/changelog.json | 0 src/graphql/data/{dotcom => fpt}/previews.json | 0 src/graphql/data/{dotcom => fpt}/schema.json | 0 src/graphql/data/{dotcom => fpt}/upcoming-changes.json | 0 src/graphql/lib/index.js | 2 +- src/graphql/scripts/README.md | 4 ++-- src/graphql/scripts/{update-files.js => sync.js} | 6 +++--- src/graphql/scripts/utils/data-filenames.json | 6 +++--- src/graphql/tests/validate-schema.js | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) rename .github/workflows/{update-graphql-files.yml => sync-graphql.yml} (93%) rename src/graphql/data/{dotcom => fpt}/changelog.json (100%) rename src/graphql/data/{dotcom => fpt}/previews.json (100%) rename src/graphql/data/{dotcom => fpt}/schema.json (100%) rename src/graphql/data/{dotcom => fpt}/upcoming-changes.json (100%) rename src/graphql/scripts/{update-files.js => sync.js} (97%) diff --git a/.github/workflows/update-graphql-files.yml b/.github/workflows/sync-graphql.yml similarity index 93% rename from .github/workflows/update-graphql-files.yml rename to .github/workflows/sync-graphql.yml index 9ca2fa9e1630..8ee1b009ba0a 100644 --- a/.github/workflows/update-graphql-files.yml +++ b/.github/workflows/sync-graphql.yml @@ -39,7 +39,7 @@ jobs: # need to use a token from a user with access to github/github for this step GITHUB_TOKEN: ${{ secrets.DOCS_BOT_FR }} run: | - src/graphql/scripts/update-files.js + src/graphql/scripts/sync.js - name: Create pull request id: create-pull-request uses: peter-evans/create-pull-request@5b4a9f6a9e2af26e5f02351490b90d01eb8ec1e5 # pin @v5.0.0 @@ -52,7 +52,7 @@ jobs: # don't trigger other workflows and this action force pushes updates # from the default branch. token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} - commit-message: 'Action ran graphql script"update-files"' + commit-message: 'Update GraphQL data files' title: GraphQL schema update body: "Hello! Some GraphQL data in github/github was updated recently. This PR @@ -87,4 +87,4 @@ jobs: channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }} color: failure - text: The last update-graphql-files run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/update-graphql-files.yml + text: The last sync-graphql run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions/workflows/sync-graphql.yml diff --git a/src/ghes-releases/lib/release-steps.md b/src/ghes-releases/lib/release-steps.md index a5d3a693554e..019d2f4631fa 100644 --- a/src/ghes-releases/lib/release-steps.md +++ b/src/ghes-releases/lib/release-steps.md @@ -323,5 +323,5 @@ This file should be automatically updated, but you can also run `src/ghes-releas - [ ] After unfreezing, alert the Ecosystem-API team in #ecosystem-api the docs freeze is finished/thawed and the release has shipped. - [ ] You (or they) can now remove your blocking review on the auto-generated "Update OpenAPI Descriptions" PR in public REST API description (the `rest-api-descriptions` repo). (although it's likely newer PRs have been created since yours with the blocking review, in which case the Ecosystem-API team will close your PR and perform the next step on the most recent PR). - [ ] The Ecosystem-API team will merge the latest auto-generated "Update OpenAPI Descriptions" PR (which will contain the OpenAPI schema config that changed `published` to `true` for the release). -- [ ] After unfreezing, if there were significant or highlighted GraphQL changes in the release, consider manually running the [GraphQL update workflow](https://github.com/github/docs-internal/actions/workflows/update-graphql-files.yml) to update our GraphQL schemas. By default this workflow only runs once every 24 hours. +- [ ] After unfreezing, if there were significant or highlighted GraphQL changes in the release, consider manually running the [GraphQL update workflow](https://github.com/github/docs-internal/actions/workflows/sync-graphql.yml) to update our GraphQL schemas. By default this workflow only runs once every 24 hours. - [ ] After the release, in the `docs-content` repo, add the now live version number to the "Specific GHES version(s)" section in [`.github/ISSUE_TEMPLATE/release-tracking.yml`](https://github.com/github/docs-content/blob/main/.github/ISSUE_TEMPLATE/release-tracking.yml). When the PR is approved, merge it in. \ No newline at end of file diff --git a/src/graphql/README.md b/src/graphql/README.md index 452a42b9f6c3..e63dc3de3807 100644 --- a/src/graphql/README.md +++ b/src/graphql/README.md @@ -17,7 +17,7 @@ ## Data files -Generated by `src/graphql/scripts/update-files.js`: +Generated by `src/graphql/scripts/sync.js`: * `src/graphql/data/schema-VERSION.json` (separate files per version) * `src/graphql/data/previews.json` diff --git a/src/graphql/data/dotcom/changelog.json b/src/graphql/data/fpt/changelog.json similarity index 100% rename from src/graphql/data/dotcom/changelog.json rename to src/graphql/data/fpt/changelog.json diff --git a/src/graphql/data/dotcom/previews.json b/src/graphql/data/fpt/previews.json similarity index 100% rename from src/graphql/data/dotcom/previews.json rename to src/graphql/data/fpt/previews.json diff --git a/src/graphql/data/dotcom/schema.json b/src/graphql/data/fpt/schema.json similarity index 100% rename from src/graphql/data/dotcom/schema.json rename to src/graphql/data/fpt/schema.json diff --git a/src/graphql/data/dotcom/upcoming-changes.json b/src/graphql/data/fpt/upcoming-changes.json similarity index 100% rename from src/graphql/data/dotcom/upcoming-changes.json rename to src/graphql/data/fpt/upcoming-changes.json diff --git a/src/graphql/lib/index.js b/src/graphql/lib/index.js index 64988aad5435..5b2f0d96ea57 100644 --- a/src/graphql/lib/index.js +++ b/src/graphql/lib/index.js @@ -92,5 +92,5 @@ function getGraphqlVersion(version) { if (!(version in allVersions)) { throw new Error(`Unrecognized version '${version}'. Not found in ${Object.keys(allVersions)}`) } - return allVersions[version].miscVersionName + return allVersions[version].openApiVersionName } diff --git a/src/graphql/scripts/README.md b/src/graphql/scripts/README.md index 56dba7575b49..33b557639793 100644 --- a/src/graphql/scripts/README.md +++ b/src/graphql/scripts/README.md @@ -1,9 +1,9 @@ # GraphQL scripts -A [scheduled workflow](../.github/workflows/update-graphql-files.yml) runs the following +A [scheduled workflow](../.github/workflows/sync-graphql.yml) runs the following scripts on a daily basis: ``` -src/graphql/scripts/update-files.js +src/graphql/scripts/sync.js ``` These scripts update the [JSON data files](src/graphql/data) used to render GraphQL docs. See the [`src/graphql/README`](src/graphql/README.md) diff --git a/src/graphql/scripts/update-files.js b/src/graphql/scripts/sync.js similarity index 97% rename from src/graphql/scripts/update-files.js rename to src/graphql/scripts/sync.js index 664a3a4dccf4..303318896ac8 100755 --- a/src/graphql/scripts/update-files.js +++ b/src/graphql/scripts/sync.js @@ -32,7 +32,7 @@ async function main() { // For example, free-pro-team@latest corresponds to dotcom, // enterprise-server@2.22 corresponds to ghes-2.22, // and github-ae@latest corresponds to ghae - const graphqlVersion = allVersions[version].miscVersionName + const graphqlVersion = allVersions[version].openApiVersionName // 1. UPDATE PREVIEWS const previewsPath = getDataFilepath('previews', graphqlVersion) @@ -115,7 +115,7 @@ function getDataFilepath(id, graphqlVersion) { // dotcom files live at the root of data/graphql // non-dotcom files live in data/graphql/ - const dataSubdir = graphqlVersion === 'dotcom' ? '' : graphqlVersion + const dataSubdir = graphqlVersion === 'fpt' ? '' : graphqlVersion return path.join(graphqlDataDir, dataSubdir, filename) } @@ -125,7 +125,7 @@ async function setBranchAsRef(options, graphqlVersion, branch = false) { const defaultBranch = 'master' const branches = { - dotcom: defaultBranch, + fpt: defaultBranch, ghec: defaultBranch, ghes: `enterprise-${graphqlVersion.replace('ghes-', '')}-release`, // TODO confirm the below is accurate after the release branch is created diff --git a/src/graphql/scripts/utils/data-filenames.json b/src/graphql/scripts/utils/data-filenames.json index 6c31a7b7d4ec..c6bf1572a6b1 100755 --- a/src/graphql/scripts/utils/data-filenames.json +++ b/src/graphql/scripts/utils/data-filenames.json @@ -1,18 +1,18 @@ { "schemas": { - "dotcom": "schema.docs.graphql", + "fpt": "schema.docs.graphql", "ghec": "schema.docs.graphql", "ghes": "schema.docs-enterprise.graphql", "ghae": "schema.docs-ghae.graphql" }, "previews": { - "dotcom": "graphql_previews.yml", + "fpt": "graphql_previews.yml", "ghec": "graphql_previews.yml", "ghes": "graphql_previews.enterprise.yml", "ghae": "graphql_previews.ghae.yml" }, "upcomingChanges": { - "dotcom": "graphql_upcoming_changes.public.yml", + "fpt": "graphql_upcoming_changes.public.yml", "ghec": "graphql_upcoming_changes.public.yml", "ghes": "graphql_upcoming_changes.public-enterprise.yml", "ghae": "graphql_upcoming_changes.public-ghae.yml" diff --git a/src/graphql/tests/validate-schema.js b/src/graphql/tests/validate-schema.js index 254cc27cf84e..bdbdf83f6050 100644 --- a/src/graphql/tests/validate-schema.js +++ b/src/graphql/tests/validate-schema.js @@ -8,7 +8,7 @@ import { allVersions } from '../../../lib/all-versions.js' import { GRAPHQL_DATA_DIR } from '../lib/index.js' const allVersionValues = Object.values(allVersions) -const graphqlVersions = allVersionValues.map((v) => v.miscVersionName) +const graphqlVersions = allVersionValues.map((v) => v.openApiVersionName) const graphqlTypes = readJsonFile('./src/graphql/lib/types.json').map((t) => t.kind) const ajv = new Ajv({ allErrors: true, allowUnionTypes: true })