-
Notifications
You must be signed in to change notification settings - Fork 84
feat: add support for fetching a greeting CTA as part of the update flow MONGOSH-1897 #2254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0549169
feat: add support for fetching a greeting CTA as part of the update flow
nirinchev 43efe22
Add a comment
nirinchev 2a0955f
Wire up some basic cli commands for updating the cta
nirinchev 0c60796
Add a test
nirinchev 3f62f0c
Merge branch 'main' into ni/cta
nirinchev 156a2cf
Add more tests, github workflow
nirinchev 9d87c8d
Merge branch 'main' into ni/cta
nirinchev a509211
CR fixes
nirinchev b1fb4f8
Rework cta validations
nirinchev 2e13801
CR comments
nirinchev 2030107
fix lint
nirinchev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.