generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI] Dynamically addign frontmatter to documentation pages based on p…
…ricing-list workflow Signed-off-by: Ankita Sahu <[email protected]>
- Loading branch information
Showing
4 changed files
with
550 additions
and
60 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 Pricing List and Front Matter | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
spreadsheet_uri: | ||
description: 'Link of the spreadsheet containing subscription details.' | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
update-pricing-and-frontmatter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Trigger Pricing List workflow via GitHub API | ||
run: | | ||
curl -X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}" \ | ||
https://api.github.com/repos/layer5labs/meshery-extensions-packages/actions/workflows/generate-pricing-list.yml/dispatches \ | ||
-d '{"ref":"master", "inputs":{"spreadsheet_uri":"${{ inputs.spreadsheet_uri }}"}}' | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.17' # Specify the Go version you need | ||
|
||
- name: Wait for Pricing List workflow to complete | ||
run: | | ||
# You may need to implement a polling mechanism here to check the status of the other workflow | ||
# For simplicity, we'll just wait for a fixed amount of time | ||
sleep 60 # Adjust this time based on how long the pricing list workflow typically takes | ||
- name: Pull latest changes | ||
run: | | ||
git pull origin master | ||
- name: Run update_frontmatter.go | ||
run: go run update_frontmatter.go | ||
|
||
- name: Commit and push if there are changes | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add . | ||
git diff --quiet && git diff --staged --quiet || (git commit -m "Update front matter based on new pricing data" && git push) |
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,22 @@ | ||
{{ $feature_name := .Get "feature_name" }} | ||
{{ $pricingDataJson := getJSON "pricing_data.json" }} | ||
|
||
{{ if $pricingDataJson }} | ||
{{ $feature := index (where $pricingDataJson "entire_row.Feature" $feature_name) 0 }} | ||
|
||
<div class="matterinfo"> | ||
<h4 class="matterheader">Who can use this feature</h4> | ||
|
||
{{ if $feature }} | ||
{{ $subscription_tier := index $feature.entire_row "Subscription Tier" }} | ||
<div class="plan-support all-plans {{ lower $subscription_tier }}-plan"> | ||
<img src="/icons/discuss.svg" alt="Icon" class="support-icon"> | ||
Supported on <span class="tier"> {{ $subscription_tier }} </span> Plan | ||
</div> | ||
{{ else }} | ||
<p>Feature information not found</p> | ||
{{ end }} | ||
</div> | ||
{{ else }} | ||
<p>Error: Could not load pricing data</p> | ||
{{ end }} |
Oops, something went wrong.