Skip to content

Commit

Permalink
unify the directory and script names for graphql pipeline (#36756)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachmari authored May 1, 2023
1 parent 27aa43f commit 56f2e50
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/ghes-releases/lib/release-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion src/graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/graphql/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions src/graphql/scripts/README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function main() {
// For example, free-pro-team@latest corresponds to dotcom,
// [email protected] 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)
Expand Down Expand Up @@ -115,7 +115,7 @@ function getDataFilepath(id, graphqlVersion) {

// dotcom files live at the root of data/graphql
// non-dotcom files live in data/graphql/<version_subdir>
const dataSubdir = graphqlVersion === 'dotcom' ? '' : graphqlVersion
const dataSubdir = graphqlVersion === 'fpt' ? '' : graphqlVersion

return path.join(graphqlDataDir, dataSubdir, filename)
}
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/graphql/scripts/utils/data-filenames.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/tests/validate-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down

0 comments on commit 56f2e50

Please sign in to comment.