-
Notifications
You must be signed in to change notification settings - Fork 1.3k
171 lines (151 loc) · 5.61 KB
/
feature-list.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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