Skip to content

Feature List

Feature List #30

Workflow file for this run

name: Feature List
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
permissions:
contents: write
actions: read
jobs:
trigger-feature-list:
runs-on: ubuntu-latest
env:
FEATURES_FILE: 'src/sections/Pricing/feature_data.json'
SPREADSHEET_URL: 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQwzrUSKfuSRcpkp7sJTw1cSB63s4HCjYLJeGPWECsvqn222hjaaONQlN4X8auKvlaB0es3BqV5rQyz/pub?gid=829069645&single=true&output=csv'
steps:
- name: Checkout current repository
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: |
npm install csvtojson --legacy-peer-deps
- name: Fetch spreadsheet and process updates
run: |
# Download the spreadsheet
curl -L $SPREADSHEET_URL -o spreadsheet.csv
# Process the CSV, filter data, and append to feature_data.json
node -e "
const fs = require('fs');
const csv = require('csvtojson');
const headers = [
'Theme (also: Keychain Name)',
'Category',
'Function',
'Feature',
'Primary Persona',
'Entitlement',
'Subscription Tier',
'Free Comparison Tier',
'TeamDesigner Comparison Tier',
'TeamOperator Comparison Tier',
'Enterprise Comparison Tier',
'Tech',
'Version',
'Engineer',
'Pricing Page?',
'Video?',
'Documented?',
'Anonymous',
'Authorization',
'Team Admin',
'Workspace Admin',
'Org Billing Manager',
'Org Admin',
'Provider Admin',
'Curator',
'MeshMap',
'Keychain ID',
'SQL',
'Key ID',
'Inserted',
'Local Provider',
'Update SQL',
'E2E Test',
];
csv({
noheader: true, // Ignore the first row as headers
headers: headers, // Use our custom headers
output: 'json', // Output as JSON
})
.fromFile('spreadsheet.csv')
.then(rows => {
// Filter data
const filteredData = rows
.map(row => {
const pricingPage = row['Pricing Page?']?.toLowerCase() || '';
const documented = row['Documented?']?.trim() || '';
const includeRow =
(pricingPage && ['x', 'X', 'true'].includes(pricingPage)) ||
(documented.startsWith('https://docs.meshery.io/') ||
documented.startsWith('https://docs.layer5.io/'));
if (!includeRow) return null;
return {
theme: row['Theme (also: Keychain Name)'],
category: row['Category'],
function: row['Function'],
feature: row['Feature'],
subscription_tier: row['Subscription Tier'],
comparison_tiers: {
free: row['Free Comparison Tier'],
teamDesigner: row['TeamDesigner Comparison Tier'],
teamOperator: row['TeamOperator Comparison Tier'],
enterprise: row['Enterprise Comparison Tier'],
},
};
})
.filter(Boolean);
// Read existing JSON data
const featuresFile = process.env.FEATURES_FILE;
let existingData = [];
if (fs.existsSync(featuresFile)) {
existingData = JSON.parse(fs.readFileSync(featuresFile, 'utf8'));
}
// Identify new updates
const newUpdates = filteredData.filter(
newRow =>
!existingData.some(
existingRow =>
existingRow.function === newRow.function &&
existingRow.feature === newRow.feature
)
);
// Set output for has-updates
if (newUpdates.length > 0) {
fs.appendFileSync(process.env.GITHUB_ENV, 'has-updates=true\n');
} else {
fs.appendFileSync(process.env.GITHUB_ENV, 'has-updates=false\n');
}
// Merge new updates into existing data
const updatedData = [...existingData, ...newUpdates];
// Write updated data to file
try {
fs.writeFileSync(featuresFile, JSON.stringify(updatedData, null, 2));
} catch (error) {
console.error('Error writing to feature_data.json:', error);
}
})
.catch(error => {
console.error('Error processing spreadsheet:', error);
process.exit(1);
});
"
- name: Commit changes
id: commit-changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Updated feature data from spreadsheet"
file_pattern: ${{ env.FEATURES_FILE }}
branch: master
commit_options: "--signoff"
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: 'l5io <[email protected]>'
call-build-and-deploy--workflow:
needs:
- trigger-feature-list
name: Build and Deploy Site
uses: layer5io/layer5/.github/workflows/build-and-deploy-site.yml@master
secrets: inherit