Open junaruga opened 1 year ago
I have implemented a way to process regex for the branch
option on trigger: commit
. It was part of experiments with the merge queues on GitHub, so it is not yet documented and well tested.
I would suggest trying:
- <<: *copr
# Run on push to any branch.
trigger: commit
branch: '^(?!.*master)'
Thanks for the suggestion. Why is it the branch: '^(?!.*master)'
rather than branch: '^(?!master)'
?
Checking the Python regular expression syntax (?!...)
at https://docs.python.org/3/library/re.html. If you trim the heading and tailing spaces of the value of the branch
. I think we can omit the ^
in the '^(?!master)'
too.
I experimented.
$ python3 --version
Python 3.11.3
$ python3
...
>>> import re
>>> p = re.compile('^(?!master)')
>>> print(p.match('master'))
None
>>> print(p.match(' master'))
<re.Match object; span=(0, 0), match=''>
>>> print(p.match('amaster'))
<re.Match object; span=(0, 0), match=''>
>>> print(p.match('mastera'))
None
>>> import re
>>> p = re.compile('(?!master)')
>>> print(p.match('master'))
None
>>> print(p.match('amaster'))
<re.Match object; span=(0, 0), match=''>
>>> print(p.match(' master'))
<re.Match object; span=(0, 0), match=''>
>>> print(p.match('mastera'))
None
>>> print(p.match('master '))
None
It seems I was able to run the CI on the push on a branch (wip/packit-copr-push
).
https://dashboard.packit.dev/results/copr-builds/810710
+ branch: '(?!master)'
Thanks for letting me know, I'll transfer it to the repo with docs, so it can be properly documented.
ad the suggested regex, it was just a guess :)
Okay. Thanks for implementing this!
Description
I want to run Packit as a service on push for the specific branches. I want to trigger any branches except
master
branch. Below is my current.packit.yml
configuration. Is there a way to do it? I check the https://dashboard.packit.dev/pipelines page. But it seems nothing triggers in the push for a branch with the following configuration. Does the currentbranch:
syntax support the regular expression?Benefit
Users can test their commit by running on CI before sending the PR to the target repository.
Importance
GitHub Actions have the feature to set the triggered branches using the wildcard by
branches
andbranches-ignore
syntax. https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#using-filters https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#example-excluding-branchesWorkaround
Participation