Adds a few examples as a ruleset scenario, with example names - #1462
Open
colindean wants to merge 1 commit into
Open
Adds a few examples as a ruleset scenario, with example names#1462colindean wants to merge 1 commit into
colindean wants to merge 1 commit into
Conversation
I ran into a situation wherein
```yaml
ruleset:
event: [push, tag]
branch: [main]
```
which expands to
```yaml
ruleset:
if:
branch: [main]
event: [push, tag]
operator: and
matcher: filepath
```
was behaving unexpectedly.
I expected this step to run on _any_ tag, but it was only running when
a tagged commit is on the main branch, or the tag event from GitHub
indicates that the ref came from the main branch. This caused a critical
step to miss when someone tried to tag for release a commit on a hotfix
branch, not main, a scenario we want to allow.
This "scenario" testing pattern can show this setup to be false while
producing some test-based documention of what the user shouldn't do to
try to fix it.
I also added a name field to the test examples, because the number only
wasn't very useful.
Also, add eval scenario that passes the (event:push&&branch:main)||event:tag.
@ecrupper suggested and tested this, and the real test here confirms it!
Signed-off-by: Colin Dean <colin.dean@target.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I ran into a situation wherein
which expands to
was behaving unexpectedly.
I expected this step to run on any tag, but it was only running when a tagged commit is on the main branch, or the tag event from GitHub indicates that the ref came from the main branch. This caused a critical step to miss when someone tried to tag for release a commit on a hotfix branch, not main, a scenario we want to allow.
This "scenario" testing pattern can show this setup to be false while producing some test-based documention of what the user shouldn't do to try to fix it.
I also added a name field to the test examples, because the number only wasn't very useful.