Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion dist/check-group/core/subproj_matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ var matchFilenamesToSubprojects = function (filenames, subprojConfigs) {
// https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-and-excluding-paths
var isNegation = path.startsWith("!");
// https://www.npmjs.com/package/minimatch
var matches = minimatch_1.default.match(filenames, path, { "flipNegate": isNegation });
// `dot: true` aligns with GitHub Actions' own `paths:` filter, which uses
// minimatch with the same option — without it, patterns like `**` would
// silently fail to match paths containing dot-prefixed segments (e.g.
// `.github/foo` or `my-project/.env.staging`), causing subprojects to
// appear inactive for PRs that touch only such paths.
var matches = minimatch_1.default.match(filenames, path, { "flipNegate": isNegation, "dot": true });
// if it's a negation, delete from the list of hits, otherwise add
matches.forEach(function (match) { return (isNegation) ? hits.delete(match) : hits.add(match); });
});
Expand Down
7 changes: 6 additions & 1 deletion src/check-group/core/subproj_matching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ export const matchFilenamesToSubprojects = (
// https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-and-excluding-paths
const isNegation = path.startsWith("!")
// https://www.npmjs.com/package/minimatch
const matches = minimatch.match(filenames, path, {"flipNegate": isNegation})
// `dot: true` aligns with GitHub Actions' own `paths:` filter, which uses
// minimatch with the same option — without it, patterns like `**` would
// silently fail to match paths containing dot-prefixed segments (e.g.
// `.github/foo` or `my-project/.env.staging`), causing subprojects to
// appear inactive for PRs that touch only such paths.
const matches = minimatch.match(filenames, path, {"flipNegate": isNegation, "dot": true})
// if it's a negation, delete from the list of hits, otherwise add
matches.forEach((match: string) => (isNegation) ? hits.delete(match): hits.add(match))
});
Expand Down
Loading