]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
github-ci: allow pull request URL in SV_BRANCH 9124/head 9129/head
authorJason Ish <jason.ish@oisf.net>
Wed, 28 Jun 2023 18:32:35 +0000 (12:32 -0600)
committerJason Ish <jason.ish@oisf.net>
Sat, 1 Jul 2023 14:55:41 +0000 (08:55 -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.

(cherry picked from commit f870dcd4cc1c72cdf5faf790a1582347ed87ab9f)

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

index c6a815c56ddde9ac32d6fc2246bd49da539d8df2..447f9121e04634424c5392eb94666a77c9d2d411 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 3b35a3ca86fc8cb1d72fbc0c0a36ee5758549d05..8e1dc09db532ed48d606a77b1947bda688ec3137 100644 (file)
@@ -90,7 +90,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}"