-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat(pipelines): ✨ Config allowed pipeline branches #500
Open
JWWilks
wants to merge
6
commits into
immobiliare:next
Choose a base branch
from
JWWilks:feature/add-pipeline-filtering
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
60a5c7b
feat(pipelines): :sparkles: adds the ability to filter which pipeline…
JWWilks d36fccc
refactor: :recycle: remove duplication
JWWilks 18ed453
Merge pull request #517 from immobiliare/next
antoniomuso 15965bb
chore(release): publish
antoniomuso 0e9e0ac
chore: merge main into branch
JWWilks 43109ff
refactor: fetch all pipelines despite filtering
JWWilks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { convertWildcardFilterArrayToFilterFunction } from './utils'; | ||
|
||
describe('convertWildcardFilterArrayToFilterFunction', () => { | ||
it('should return true if input matches any of the validInputs', () => { | ||
const input = 'foobar'; | ||
const validInputs = ['foo*', 'bar', 'baz']; | ||
const result = convertWildcardFilterArrayToFilterFunction( | ||
input, | ||
validInputs | ||
); | ||
expect(result).toBeTruthy(); | ||
}); | ||
|
||
it('should return false if input does not match any of the validInputs', () => { | ||
const input = 'foobar'; | ||
const validInputs = ['baz', 'qux']; | ||
const result = convertWildcardFilterArrayToFilterFunction( | ||
input, | ||
validInputs | ||
); | ||
expect(result).toBeFalsy(); | ||
}); | ||
|
||
it('should account for multiple wildcards in the validInputs', () => { | ||
const input = 'foobar'; | ||
const validInputs = ['foo*', '*bar', 'baz']; | ||
const result = convertWildcardFilterArrayToFilterFunction( | ||
input, | ||
validInputs | ||
); | ||
expect(result).toBeTruthy(); | ||
}); | ||
|
||
it('should always return true if any of the valid inputs is *', () => { | ||
const input = 'foobar'; | ||
const validInputs = ['*']; | ||
const result = convertWildcardFilterArrayToFilterFunction( | ||
input, | ||
validInputs | ||
); | ||
expect(result).toBeTruthy(); | ||
}); | ||
|
||
it('should account for ** in the validInputs', () => { | ||
const input = 'foobar'; | ||
const validInputs = ['foo**', 'bar', 'baz']; | ||
const result = convertWildcardFilterArrayToFilterFunction( | ||
input, | ||
validInputs | ||
); | ||
expect(result).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,3 +114,14 @@ const parseCodeOwnerLine = (rule: string): FileOwnership => { | |
// ensures that only the following patterns are allowed @octocat @octocat/kitty [email protected] | ||
const codeOwnerRegex = | ||
/(^@[a-zA-Z0-9_\-/]*$)|(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/; | ||
|
||
export const convertWildcardFilterArrayToFilterFunction = ( | ||
input: string, // eg: 'foobar' | ||
validInputs: string[] // eg: ['foo*', 'bar', 'baz'] | ||
) => { | ||
const regex = new RegExp( | ||
`^${validInputs.join('|').split('*').join('(.+)')}$` | ||
); | ||
|
||
return regex.test(input); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this can reduce the number of pipelines you get:
Example
Having this annotation:
if in your last 50 pipelines, 49 are in branches different from main and develop you will get only one pipeline in your card. Then you can make a request for each branch ex.
/projects/2416/pipelines?ref=${branch}
(with this approach you get more pipelines than before) or better you can use graphqlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @antoniomuso, good catch haven't forgotten about this - just swamped with other work. Hoping to pick this back up in early aug :)