From f870dcd4cc1c72cdf5faf790a1582347ed87ab9f Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Wed, 28 Jun 2023 12:32:35 -0600 Subject: [PATCH] github-ci: allow pull request URL in SV_BRANCH 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 | 6 +++++- .github/workflows/builds.yml | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e96bcd9a0b..08722f7c7e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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= diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 73bb9135d6..69db01dfce 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -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}" -- 2.47.2