]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
github-ci: allow pull request URL in SV_BRANCH 9093/head
authorJason Ish <jason.ish@oisf.net>
Wed, 28 Jun 2023 18:32:35 +0000 (12:32 -0600)
committerJason Ish <jason.ish@oisf.net>
Wed, 28 Jun 2023 18:36:18 +0000 (12:36 -0600)
Allow the SV_BRANCH variable to contain the full link to an
OISF/suricata-verify pull request. This will cause GitHub to create a
cross-link for us.

.github/PULL_REQUEST_TEMPLATE.md
.github/workflows/builds.yml

index e96bcd9a0b95326cbc3c5592cd344a6ac8416cb0..08722f7c7e9fb97496ce107d16adf8078f0fc0e0 100644 (file)
@@ -13,7 +13,11 @@ Describe changes:
 
 ### Provide values to any of the below to override the defaults.
 
-To use a pull request use a branch name like `pr/N` where `N` is the pull request number.
+To use a pull request use a branch name like `pr/N` where `N` is the
+pull request number.
+
+Alternatively, `SV_BRANCH` may also be a link to an
+OISF/suricata-verify pull-request.
 
 ```
 SV_REPO=
index 73bb9135d6f9b315ca660c0e30e622d8cbc523af..69db01dfceb6eb4effe4ad2bf126205500d766fd 100644 (file)
@@ -117,7 +117,13 @@ jobs:
 
       - name: Fetching suricata-verify
         run: |
-          pr=$(echo "${SV_BRANCH}" | sed -n 's/^pr\/\([[:digit:]]\+\)$/\1/p')
+          # Looking for a pull request number. in the SV_BRANCH
+          # value. This could be "pr/NNN", "pull/NNN" or a link to an
+          # OISF/suricata-verify pull request.
+          pr=$(echo "${SV_BRANCH}" | sed -n \
+              -e 's/^https:\/\/github.com\/OISF\/suricata-verify\/pull\/\([0-9]*\)$/\1/p' \
+              -e 's/^pull\/\([0-9]*\)$/\1/p' \
+              -e 's/^pr\/\([0-9]*\)$/\1/p')
           if [ "${pr}" ]; then
               SV_BRANCH="refs/pull/${pr}/head"
               echo "Using suricata-verify pull-request ${SV_BRANCH}"