-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for fetching a greeting CTA as part of the update f…
…low MONGOSH-1897 (#2254) * feat: add support for fetching a greeting CTA as part of the update flow * Add a comment * Wire up some basic cli commands for updating the cta * Add a test * Add more tests, github workflow * Rework cta validations * CR comments * fix lint
- Loading branch information
Showing
22 changed files
with
837 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Update greeting CTA | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- config/cta.conf.js | ||
workflow_dispatch: | ||
inputs: | ||
dry-run: | ||
description: Run the script without updating the CTA | ||
type: boolean | ||
required: false | ||
default: false | ||
environment: | ||
description: The environment to run the script in - must have the DOWNLOAD_CENTER_AWS_KEY and DOWNLOAD_CENTER_AWS_SECRET secrets configured | ||
type: environment | ||
required: true | ||
default: CTA-Production | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
dry-run: | ||
name: Update greeting CTA | ||
runs-on: ubuntu-latest | ||
environment: ${{ github.event.inputs.environment || 'CTA-Production'}} | ||
env: | ||
npm_config_loglevel: verbose | ||
npm_config_foreground_scripts: "true" | ||
PUPPETEER_SKIP_DOWNLOAD: "true" | ||
DOWNLOAD_CENTER_AWS_KEY: ${{ secrets.DOWNLOAD_CENTER_AWS_KEY }} | ||
DOWNLOAD_CENTER_AWS_SECRET: ${{ secrets.DOWNLOAD_CENTER_AWS_SECRET }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ^20.x | ||
cache: "npm" | ||
|
||
- name: Install Dependencies and Compile | ||
run: | | ||
npm ci | ||
npm run compile | ||
- name: Update greeting CTA | ||
run: | | ||
npm run update-cta ${{ github.event.inputs.dry-run && '-- --dry-run' || '' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"$schema": "./cta-config.schema.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
"$id": "https://mongodb.com/schemas/mongosh/cta-config", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "CTAConfig", | ||
"type": "object", | ||
"properties": { | ||
"*": { | ||
"$ref": "#/definitions/GreetingCTADetails", | ||
"description": "The default CTA for all versions that don't have an explicit one defined." | ||
}, | ||
"$schema": { | ||
"type": "string" | ||
} | ||
}, | ||
"patternProperties": { | ||
"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$": { | ||
"$ref": "#/definitions/GreetingCTADetails", | ||
"description": "The CTA for a specific version.", | ||
"$comment": "The property name must be a valid semver string." | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"definitions": { | ||
"GreetingCTADetails": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"chunks": { | ||
"description": "The chunks that make up the CTA. They will be combined sequentially with no additional spacing added.", | ||
"items": { | ||
"properties": { | ||
"style": { | ||
"description": "The style to apply to the text. It must match the values from clr.ts/StyleDefinition.", | ||
"enum": [ | ||
"reset", | ||
"bold", | ||
"italic", | ||
"underline", | ||
"fontDefault", | ||
"font2", | ||
"font3", | ||
"font4", | ||
"font5", | ||
"font6", | ||
"imageNegative", | ||
"imagePositive", | ||
"black", | ||
"red", | ||
"green", | ||
"yellow", | ||
"blue", | ||
"magenta", | ||
"cyan", | ||
"white", | ||
"grey", | ||
"gray", | ||
"bg-black", | ||
"bg-red", | ||
"bg-green", | ||
"bg-yellow", | ||
"bg-blue", | ||
"bg-magenta", | ||
"bg-cyan", | ||
"bg-white", | ||
"bg-grey", | ||
"bg-gray", | ||
"mongosh:warning", | ||
"mongosh:error", | ||
"mongosh:section-header", | ||
"mongosh:uri", | ||
"mongosh:filename", | ||
"mongosh:additional-error-info" | ||
], | ||
"type": "string" | ||
}, | ||
"text": { | ||
"type": "string", | ||
"description": "The text in the chunk." | ||
} | ||
}, | ||
"type": "object", | ||
"required": [ | ||
"text" | ||
] | ||
}, | ||
"type": "array" | ||
} | ||
}, | ||
"required": [ | ||
"chunks" | ||
] | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.