Skip to content

Commit

Permalink
Merge branch 'develop' into apm-rework-all-ia
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleycamacho committed May 27, 2022
2 parents 1a1e4e9 + 52f48db commit cdd1665
Show file tree
Hide file tree
Showing 1,420 changed files with 58,316 additions and 31,154 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/manual-add-files-to-translation-queue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Manually Add Slugs to Translation Queue

on:
workflow_dispatch:
inputs:
files:
description: 'String of filenames separated by comma'
required: true
type: string
machineTranslation:
description: 'Send for machine translation'
required: false
type: boolean
locale:
description: 'Define locale'
required: false
type: string

env:
DB_CONNECTION_INFO: ${{ secrets.DB_CONNECTION_INFO }}
HUMAN_TRANSLATION_PROJECT_ID: ${{ secrets.TRANSLATION_VENDOR_PROJECT }} # human project id
MACHINE_TRANSLATION_PROJECT_ID: ${{ secrets.TRANSLATION_VENDOR_MT_PROJECT }} # machine project id
NEW_RELIC_ACCOUNT_ID: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}

jobs:
get-and-save-slugs:
name: Get and Save Slugs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2

- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

- name: Get slugs and save
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn manual-add-files-to-translate -f ${{ github.event.inputs.files }} -l ${{ github.event.inputs.locale }} -mt ${{ github.event.inputs.machineTranslation }}
80 changes: 80 additions & 0 deletions .github/workflows/pr-docs-eng-board-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Add PRs to DocsEng board

on:
workflow_dispatch:
pull_request:
branches:
- develop
types:
- opened
paths-ignore:
- '**.mdx'
- '**.md'
- 'src/nav/*'
- '**/images/*'

jobs:
track_pr:
runs-on: ubuntu-latest
steps:
- name: Get project data
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
ORGANIZATION: newrelic
PROJECT_NUMBER: 65
run: |
gh api graphql -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
id
fields(first:20) {
nodes {
id
name
settings
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
echo 'TODO_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Needs Review") |.id' project_data.json) >> $GITHUB_ENV
- name: Add PR to project
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
PR_ID: ${{ github.event.pull_request.node_id }}
run: |
item_id="$( gh api graphql -f query='
mutation($project:ID!, $pr:ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $pr}) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f pr=$PR_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
- name: Set fields
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
run: |
gh api graphql -f query='
mutation (
$project: ID!
$item: ID!
$status_field: ID!
$status_value: String!
) {
set_status: updateProjectNextItemField(input: {
projectId: $project
itemId: $item
fieldId: $status_field
value: $status_value
}) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.TODO_OPTION_ID }} --silent
32 changes: 16 additions & 16 deletions .github/workflows/pr-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
PROJECT_ID: 11873277
PROJECT_NAME: Docs PRs and Issues
steps:
- name: Triages NEW pull requests to the Content Project
if: github.event.action == 'opened'
run: |
HEADER="Accept: application/vnd.github.inertia-preview+json"
PR_ID=${{ github.event.pull_request.id }}
COLUMN=$(gh api -H "$HEADER" projects/$PROJECT_ID/columns --jq ".[] | select(.name == \"$COLUMN_NAME\").id")
gh api -H "$HEADER" -X POST projects/columns/$COLUMN/cards -f content_type='PullRequest' -F content_id=$PR_ID
- name: Triages NEW pull requests to the Content Project
if: github.event.action == 'opened'
run: |
HEADER="Accept: application/vnd.github.inertia-preview+json"
PR_ID=${{ github.event.pull_request.id }}
COLUMN=$(gh api -H "$HEADER" projects/$PROJECT_ID/columns --jq ".[] | select(.name == \"$COLUMN_NAME\").id")
gh api -H "$HEADER" -X POST projects/columns/$COLUMN/cards -f content_type='PullRequest' -F content_id=$PR_ID
localization_project:
name: pr added to the localization github board (optional)
Expand All @@ -31,12 +31,12 @@ jobs:
PROJECT_ID: 12004783
PROJECT_NAME: Docs Site Localization PRs and Issues
steps:
- name: Triages NEW pull requests to the Localization Project
if: |
github.event.action == 'labeled' &&
contains(github.event.pull_request.labels.*.name, 'localization')
run: |
HEADER="Accept: application/vnd.github.inertia-preview+json"
PR_ID=${{ github.event.pull_request.id }}
COLUMN=$(gh api -H "$HEADER" projects/$PROJECT_ID/columns --jq ".[] | select(.name == \"$COLUMN_NAME\").id")
gh api -H "$HEADER" -X POST projects/columns/$COLUMN/cards -f content_type='PullRequest' -F content_id=$PR_ID
- name: Triages NEW pull requests to the Localization Project
if: |
github.event.action == 'labeled' &&
contains(github.event.pull_request.labels.*.name, 'translations')
run: |
HEADER="Accept: application/vnd.github.inertia-preview+json"
PR_ID=${{ github.event.pull_request.id }}
COLUMN=$(gh api -H "$HEADER" projects/$PROJECT_ID/columns --jq ".[] | select(.name == \"$COLUMN_NAME\").id")
gh api -H "$HEADER" -X POST projects/columns/$COLUMN/cards -f content_type='PullRequest' -F content_id=$PR_ID
52 changes: 43 additions & 9 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,52 @@ module.exports = {
},
prism: {
languages: [
'xml',
'xml-doc',
'c',
'go',
'handlebars',
'java',
'md',
'css',
'js',
'aspnet',
'csv',
'cmake',
'dax',
'diff',
'django',
'jinja2',
'docker',
'dockerfile',
'elixir',
'erlang',
'gettext',
'pascal',
'parser',
'nginx',
'n1ql',
'monkey',
'mongodb',
'liquid',
'json5',
'jsdoc',
'mustache',
'powershell',
'promql',
'protobuf',
'puppet',
'jsx',
'regex',
'ruby',
'scala',
'shell',
'swift',
'systemd',
'toml',
'velocity',
'vim',
'php',
'phpdoc',
'xml',
'xml-doc',
'csharp',
'shell',
'python',
'md',
'java',
'razor',
],
},
splitio: {
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@
"@github-docs/frontmatter": "^1.3.1",
"@mdx-js/mdx": "^2.0.0-next.8",
"@mdx-js/react": "^2.0.0-next.8",
"@newrelic/gatsby-theme-newrelic": "^5.0.3",
"@newrelic/gatsby-theme-newrelic": "6.1.0",
"@splitsoftware/splitio-react": "^1.2.4",
"cockatiel": "^3.0.0-beta.0",
"common-tags": "^1.8.0",
"date-fns": "^2.17.0",
"front-matter": "^4.0.2",
"gatsby": "^4.6.0",
"gatsby": "4.6.0",
"gatsby-image": "^3.11.0",
"gatsby-plugin-gatsby-cloud": "^4.4.0",
"gatsby-plugin-gatsby-cloud": "4.4.0",
"gatsby-plugin-json-output": "^1.2.0",
"gatsby-plugin-manifest": "^4.4.0",
"gatsby-plugin-manifest": "4.4.0",
"gatsby-plugin-mdx": "^3.4.0",
"gatsby-plugin-meta-redirect": "^1.1.1",
"gatsby-plugin-offline": "^5.4.0",
"gatsby-plugin-react-helmet": "^5.4.0",
"gatsby-plugin-sharp": "^4.4.0",
"gatsby-plugin-sharp": "4.4.0",
"gatsby-remark-autolink-headers": "^5.4.0",
"gatsby-remark-copy-linked-files": "^5.4.0",
"gatsby-remark-images": "^6.4.0",
"gatsby-source-filesystem": "^4.4.0",
"gatsby-transformer-json": "^4.4.0",
"gatsby-source-filesystem": "4.4.0",
"gatsby-transformer-json": "4.4.0",
"gatsby-transformer-remark": "^5.4.0",
"gatsby-transformer-sharp": "^4.4.0",
"gatsby-transformer-yaml": "^4.4.0",
"gatsby-transformer-sharp": "4.4.0",
"gatsby-transformer-yaml": "4.4.0",
"github-slugger": "^1.3.0",
"hast-util-from-dom": "^3.0.0",
"hast-util-has-property": "^1.0.4",
Expand Down Expand Up @@ -173,6 +173,7 @@
"postinstall": "patch-package",
"extract-i18n": "i18next",
"add-files-to-translate": "node scripts/actions/add-files-to-translation-queue.js",
"manual-add-files-to-translate": "node scripts/actions/manual-add-files-to-translation-queue.js",
"check-for-outdated-translations": "node scripts/actions/check-for-outdated-translations.js",
"verify-mdx": "node scripts/verify_mdx.js",
"add-remove-redirects": "node scripts/utils/docs-content-tools/add-remove-redirects.js",
Expand Down
7 changes: 5 additions & 2 deletions plugins/gatsby-plugin-generate-doc-json/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ exports.onPostBuild = async ({ graphql, store }) => {
nodes {
mdxAST
slug
rawBody
}
}
allImageSharp {
Expand Down Expand Up @@ -65,7 +66,7 @@ exports.onPostBuild = async ({ graphql, store }) => {
);

allMdx.nodes.forEach((node) => {
const { slug, mdxAST } = node;
const { rawBody: mdxBody, slug, mdxAST } = node;

const filepath = path.join(program.directory, 'public', `${slug}.json`);

Expand All @@ -82,7 +83,9 @@ exports.onPostBuild = async ({ graphql, store }) => {
},
})
);
const result = { body: html };

const mdx = JSON.stringify(mdxBody);
const result = { body: html, mdx };

fs.writeFileSync(filepath, JSON.stringify(result));
});
Expand Down
4 changes: 3 additions & 1 deletion plugins/gatsby-source-data-dictionary/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ exports.sourceNodes = (
{ actions, createNodeId, createContentDigest, getNodesByType },
pluginOptions
) => {
const { createNode, createRedirect } = actions;
const { createNode, createRedirect, touchNode } = actions;

const dataDictionaryNodes = getNodesByType('MarkdownRemark').filter((node) =>
node.fileAbsolutePath.includes(pluginOptions.path)
);

dataDictionaryNodes.forEach((node) => touchNode(node));

const attributeEvents = uniq(
dataDictionaryNodes
.filter(({ frontmatter }) => frontmatter.type === 'attribute')
Expand Down
9 changes: 7 additions & 2 deletions plugins/utils/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ module.exports = {
? new URL(imageHashMap[srcUrl], domain).href
: node.url;

const applyBlockImageAttributes = isBlockImage(parent, node);

return h(
node,
isBlockImage(parent, node) ? 'div' : 'span',
applyBlockImageAttributes ? 'div' : 'span',
stripNulls({
className: [isBlockImage ? 'block-image' : 'inline-image', 'image'],
className: [
applyBlockImageAttributes ? 'block-image' : 'inline-image',
'image',
],
style: get(node, 'data.style', null),
}),
[
Expand Down

0 comments on commit cdd1665

Please sign in to comment.