Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow triggerPaths to include wildcard for repository name #307

Open
dagood opened this issue Jun 7, 2018 · 0 comments
Open

Allow triggerPaths to include wildcard for repository name #307

dagood opened this issue Jun 7, 2018 · 0 comments

Comments

@dagood
Copy link
Member

dagood commented Jun 7, 2018

This would let us avoid listing every aspnet repo individually in #306.

I'd expect changes to be pretty limited to here:

private IEnumerable<Subscription> GetSubscriptions(ModifiedFileModel modifiedFile)
{
return Subscriptions.Where(s => s.TriggerPaths.Any(p => Matches(p, modifiedFile)));
}
private bool Matches(string path, ModifiedFileModel modifiedFile)
{
bool matches = string.Equals(path, modifiedFile.FullPath, StringComparison.OrdinalIgnoreCase);
if (matches)
{
return true;
}
if (path.EndsWith("/**/*", StringComparison.OrdinalIgnoreCase))
{
string rootPath = path.Substring(0, path.Length - 5);
return modifiedFile.FullPath.StartsWith(rootPath, StringComparison.OrdinalIgnoreCase);
}
return false;
}

Maybe it should change to full-blown regex. (Also solving #207.)

/cc @mmitche

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant