Skip to content

Commit

Permalink
fix(alerts): use an accurate regexp for fiche-sp filter (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelB committed Aug 11, 2020
1 parent bbf7011 commit f968208
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions targets/alert-cli/src/index.js
Expand Up @@ -66,10 +66,13 @@ function getFileFilter(repository) {
// only a ccn matching our list
return (path) => ccns.some((ccn) => new RegExp(ccn.id).test(path));
case "socialgouv/fiches-vdd":
return (path) =>
["index.json", ...listFichesVddId].some((id) =>
new RegExp(id).test(path)
return (path) => {
const matched = ["index.json", ...listFichesVddId].some((id) =>
new RegExp(`${id}.json$`).test(path)
);
console.error(path, matched);
return matched;
};
default:
return () => false;
}
Expand Down Expand Up @@ -386,7 +389,7 @@ async function getDiffFromTags(tags, repositoryId) {
const diffProcessor = getDiffProcessor(repositoryId);

for (const tag of newTags) {
console.error(tag.ref);
console.error(repositoryId, tag.ref);
const previousCommit = previousTag.commit;
const { commit } = tag;
const [prevTree, currTree] = await Promise.all([
Expand Down Expand Up @@ -418,7 +421,9 @@ async function main() {
const sources = await getSources();

const results = [];
for (const source of sources) {
for (const source of sources.filter((source) =>
/fiches-vdd/.test(source.repository)
)) {
const repo = await openRepo(source);
const tags = await getNewerTagsFromRepo(repo, source.tag);
const [lastTag] = tags.slice(-1);
Expand Down

0 comments on commit f968208

Please sign in to comment.