Skip to content

Commit

Permalink
Fix release filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
queengooborg committed Jan 6, 2023
1 parent 19a1b1d commit c3079b0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions update-bcd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,9 @@ export const update = (
const inferredStatement = inferredStatements[0];

// If there's a version number filter
if (filter.release) {
const filterMatch = filter.release.match(/([\d.]+)-([\d.]+)/);
if (filter.release !== undefined) {
const filterMatch =
filter.release && filter.release.match(/([\d.]+)-([\d.]+)/);
if (filterMatch) {
if (typeof inferredStatement.version_added !== 'string') {
// If the version_added is not a string, it must be false and won't
Expand Down Expand Up @@ -387,13 +388,13 @@ export const update = (
continue;
}
} else {
if (JSON.parse(filter.release) !== inferredStatement.version_added) {
if (filter.release !== inferredStatement.version_added) {
// If version_added doesn't match filter
continue;
}
if (
inferredStatement.version_removed &&
JSON.parse(filter.release) !== inferredStatement.version_removed
filter.release !== inferredStatement.version_removed
) {
// If version_removed and it doesn't match filter
continue;
Expand Down Expand Up @@ -623,6 +624,10 @@ export const main = async (
filter.path = new Minimatch(filter.path);
}

if (filter.release === 'false') {
filter.release = false;
}

const bcdFiles = (await loadJsonFiles(
filter.category.map((cat) => path.join(BCD_DIR, ...cat.split('.')))
)) as {[key: string]: Identifier};
Expand Down

0 comments on commit c3079b0

Please sign in to comment.