MCPcopy Create free account
hub / github.com/electric-sql/electric / changedExamples

Function changedExamples

scripts/ci/example-matrix.mjs:196–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194}
195
196function changedExamples() {
197 const base = process.env.BASE_SHA
198
199 if (!base || /^0+$/.test(base)) {
200 return examples
201 .filter((example) => example.deployOnChanges)
202 .map((example) => example.name)
203 }
204
205 try {
206 run(`git`, [`rev-parse`, `--verify`, `${base}^{commit}`])
207 return Array.from(
208 new Set(
209 run(`git`, [`diff`, `--name-only`, base, `--`, `examples`])
210 .split(`\n`)
211 .map((file) => file.trim().split(`/`)[1])
212 .filter(Boolean)
213 )
214 )
215 } catch {
216 return examples
217 .filter((example) => example.deployOnChanges)
218 .map((example) => example.name)
219 }
220}
221
222function writeOutputs(outputs) {
223 const outputFile = process.env.GITHUB_OUTPUT

Callers 1

selectExamplesFunction · 0.85

Calls 4

filterMethod · 0.80
runFunction · 0.70
mapMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected