Why doesn't my github action trigger on a regex tag - tags

For my first attempt at Github Actions I need to trigger based on a git tag such as 1.2.3-RELEASE, which seems like a common enough thing. I can find examples like this:
on:
push:
tags:
- v1 # Push events to v1 tag
- v1.* # Push events to v1.0, v1.1, and v1.9 tags
so I created my yaml file like this:
on:
push:
tags:
- '[1-9]+.[0-9]+.[0-9]+\-RELEASE'
But it never fires. I verified the regex expression with an online tool and I tried a tag v1.1 with it set up with the first example, and that worked with or without quotes. My expression needs quotes, which is fine, but it doesn't work. Anyone know what I'm doing wrong here?

The GitHub Action syntax doc does mention:
The branches, branches-ignore, tags, and tags-ignore keywords accept glob patterns that use the * and ** wildcard characters to match more than one branch or tag name.
For more information, see the "Filter pattern cheat sheet".
So a normal regex would not work.
Your expression is close enough of a glob pattern: I would try and not escape the -:
[1-9]+.[0-9]+.[0-9]+-RELEASE

Related

Search github repo for term with special characters using sourcegraph?

The top answer to How to search on GitHub to get exact string matches, including special characters shows a way to search GitHub for terms that include special characters using a tool called sourcegraph.
I got that working:
https://sourcegraph.com/search?q=context:global+.where%28&patternType=literal
but I'd like to narrow the search to a specific repo (not all of GitHub) - how can I do that?
Example
Here's the exact search I tried on GitHub:
https://github.com/sharetribe/sharetribe/search?q=.where%28
(it searches for where instead of .where(.
Here's the search on sourcegraph:
https://sourcegraph.com/search?q=context:global+.where%28&patternType=literal
It returns results for all of GitHub rather than the specific repo sharetribe/sharetribe.
How can I limit this search to one repo?
You can limit this search by using the repo filter:
https://sourcegraph.com/search?q=context:global+repo:sharetribe/sharetribe+.where%28&patternType=literal

script to capture the package name from the commit message

I am trying to set up a GitLab ci pipeline to delete packages, the pipeline will trigger only after the merge request is approved, and the package name is captured from the $CI_COMMIT_MESSAGE and pass it to the delete command to delete the package.
But the $CI_COMMIT_MESSAGE which I have given during push (decomm-xxx) is been added with a few extra lines (Merge branch 'ipl1' into 'Condition'
decomm-zzz
See Merge request lkjdscjnjsdcdsnjkjkj") after the MR is approved and merged.
How exactly can I capture the package name from the $CI_COMMIT_MESSAGE which I originally gave (decomm-xxx), I need to print only the text after "decomm-" but I am not able to print it.
Any help on this would be much appreciated, thank you.
Below is the screenshot's which I tried.
There's maybe a couple ways to do this:
Stop gitlab from adding the extra text
Write a script to accommodate the extra text added when merging an MR
Change the commit message
To stop GitLab from adding the extra text, expand the dropdown under the merge button. This will let you edit the merge commit message:
Write a more reliable script
Alternatively, you can write a script to reliably extract the text you need. Using regex is probably the most reasonable way to do this.
script:
- pattern='decomm-([A-z]+)' # adjust this pattern to suit your needs
- '[[ "$CI_COMMIT_MESSAGE" =~ $pattern ]]'
- CIMessage="${BASH_REMATCH[1]}"
- echo "$CIMessage" # zzz

GitHub Actions workflow syntax not working as expected

I have a GitHub workflow that is triggered when files according to the
pattern **/abc** are modified / created.
As far as I understand it, this means that whenever a:
File that is in some subfolder of a folder that starts with abc or
Any file that starts with abc
is modified, the GH action should be triggered.
However, the workflow is even triggered when I e.g. create a file repository/aaa/test_abc
However, to my understanding, the file repository/aaa/test_abc does not correspond to the pattern **/abc**
Do I
Misunderstand GH actions syntax or is it
A Bug in GH actions?
You need to escape the / with a \ for the pattern to work.
Using '**\/abc**' will resolve the problem.
Most of the time, the filter pattern cheat sheet for the Github Documentation helps to configure the paths, but in that specific case it wasn't detailed.

How to ignore a file in GitHub CODEOWNERS while still having a wildcard

I'm hoping this is a really simple answer I've overlooked, but I have a repo on GitHub using CODEOWNERS and would like to do the following:
# Default reviewers except for the subsequently listed things:
* #global-owner1 #global-owner2
# Some other owners
/packages/something/ #octocat
/packages/another/ #doctocat
# PRs _only_ affecting the "Some other owners" paths will
# also include a change to the CHANGELOG.md, but I don't want
# #global-owner1 or #global-owner2 to be added on those PRs.
CHANGELOG.md
Is there a way to "ignore" the CHANGELOG.md file in this way?
The file is read backwards, and the first match ends the search. So it seems like you don't need that last line, as the "some other owners paths" will get hit first.

How to filter for named branches with a partial name match in mercurial?

I use the following search expression to find all the heads which aren't closed in our mercurial repository:
head() and not closed() and not branch('default')
However, I have a convention to name feature branches as fb-(target-release)-(feature-name) and I'd also like to filter for the named branches which contain fb at the beginning of their name. Is this possible without piping the output to another application?
You can use regular expressions in the branch expression. From hg help revset:
"branch(string or set)"
All changesets belonging to the given branch or the branches of the
given changesets.
If "string" starts with "re:", the remainder of the name is treated as a
regular expression. To match a branch that actually starts with "re:",
use the prefix "literal:".
So to match fb- at the beginning of the name:
head() and not closed() and not branch('default') and branch('re:^fb-')