generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 82
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
[UI] Dynamically adding front-matter to documentation pages #379
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
367321e
[UI] Dynamically addign frontmatter to documentation pages based on p…
SAHU-01 3cc1bd8
removing unwanted commented code
SAHU-01 c4e5601
Apply suggestions from code review
leecalcote 6418131
[UI] applying suggested changes
SAHU-01 024f9c2
Merge branch 'layer5io:master' into master
SAHU-01 5eacdf3
[UI] SVG updated
SAHU-01 d3c5021
Merge branch 'master' of https://github.com/SAHU-01/docs
SAHU-01 dc234ce
Merge branch 'master' into master
vishalvivekm 6c4aa68
Merge branch 'master' into master
vishalvivekm 199a1c5
Workflow updated
SAHU-01 bb7004b
Frontmatte rPartial updated to show multiple tiers and hyperlink to p…
SAHU-01 9b61177
Removing unwanted files
SAHU-01 175d72f
requested changes updated
SAHU-01 4387fd6
Merge branch 'layer5io:master' into master
SAHU-01 6a38b10
Merge branch 'layer5io:master' into master
SAHU-01 31e0f82
simplyfing workflow logic
SAHU-01 3a0bf65
debugging workflow
SAHU-01 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 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,84 @@ | ||
name: Feature List Update | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # Run every night at midnight UTC | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
actions: write | ||
|
||
jobs: | ||
check-and-update-features: | ||
runs-on: ubuntu-latest | ||
env: | ||
FEATURES_FILE: 'data/features.json' | ||
|
||
steps: | ||
- name: Checkout current repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check for updates in source repository | ||
id: check-updates | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const { data: sourceFile } = await github.rest.repos.getContent({ | ||
owner: 'layer5labs', | ||
repo: 'meshery-extensions-packages', | ||
path: 'feature-data.json', | ||
ref: 'master' | ||
}); | ||
|
||
// Store the latest commit SHA | ||
const latestSHA = sourceFile.sha; | ||
|
||
// Try to get the previously stored SHA from cache | ||
const cache = await github.rest.actions.getActionsCacheList({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
|
||
let hasUpdates = true; | ||
if (cache.data.actions_caches.length > 0) { | ||
const lastSHA = cache.data.actions_caches[0].key.split('-').pop(); | ||
hasUpdates = lastSHA !== latestSHA; | ||
} | ||
|
||
if (hasUpdates) { | ||
// Update the cache with new SHA | ||
await github.rest.actions.createActionsCacheEntry({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
key: `feature-data-sha-${latestSHA}`, | ||
ref: context.ref, | ||
cache_data: latestSHA | ||
}); | ||
|
||
// Decode and save the content | ||
const content = Buffer.from(sourceFile.content, 'base64').toString('utf-8'); | ||
const fs = require('fs'); | ||
|
||
// Create data directory if it doesn't exist | ||
fs.mkdirSync('data', { recursive: true }); | ||
|
||
// Write the new content | ||
fs.writeFileSync('${{ env.FEATURES_FILE }}', content); | ||
|
||
core.setOutput('has-updates', 'true'); | ||
} else { | ||
core.setOutput('has-updates', 'false'); | ||
} | ||
|
||
- name: Commit changes | ||
if: steps.check-updates.outputs.has-updates == 'true' | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "Updated feature data from source repository" | ||
file_pattern: ${{ env.FEATURES_FILE }} | ||
branch: master | ||
commit_options: "--signoff" | ||
commit_user_name: l5io | ||
commit_user_email: [email protected] | ||
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of running the workflow over here? @vishalvivekm @SAHU-01 @jerensl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow fetches the integration sheet and parses the csv and gives us a json file, additionally, it filters out and returns rows of the sheet in json that we need to map, i.e. if a feature on the sheet has been documented or has been marked to be displayed on pricing page.