From: Jason Ish Date: Fri, 12 May 2023 15:41:27 +0000 (-0600) Subject: github-ci: add workflow_dispatch X-Git-Tag: suricata-7.0.0-rc2~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8c54bc7a4f4dfe85494ab5e648b80ac5ac97723;p=thirdparty%2Fsuricata.git github-ci: add workflow_dispatch A workflow dispatch allows us to manually a trigger a workflow with arguments. This dispatch allows us to use the "gh" cli command to trigger a workflow run with our libhtp/su/sv branch and repo variables set. For example: gh run builds.yml -f SV_REPO=jasonish/suricata-verify -f SV_BRANCH=pr/10 --- diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index cece9234bc..1534cf4394 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -1,8 +1,16 @@ name: builds on: - - push - - pull_request + push: + pull_request: + workflow_dispatch: + inputs: + LIBHTP_REPO: + LIBHTP_BRANCH: + SU_REPO: + SU_BRANCH: + SV_REPO: + SV_BRANCH: permissions: read-all @@ -56,7 +64,24 @@ jobs: SV_REPO=$(echo "${body}" | awk -F = '/^SV_REPO=/ { print $2 }') SV_BRANCH=$(echo "${body}" | awk -F = '/^SV_BRANCH=/ { print $2 }') else - echo "No pull request body, will use defaults." + echo "No pull request body, will use inputs or defaults." + LIBHTP_REPO=${{ inputs.LIBHTP_REPO }} + LIBHTP_BRANCH=${{ inputs.LIBHTP_BRANCH }} + SU_REPO=${{ inputs.SU_REPO }} + SU_BRANCH=${{ inputs.SU_BRANCH }} + SV_REPO=${{ inputs.SV_REPO }} + SV_BRANCH=${{ inputs.SV_BRANCH }} + fi + + # If the _REPO variables don't contain a full URL, add GitHub. + if [ "${LIBHTP_REPO}" ] && ! echo "${LIBHTP_REPO}" | grep -q '^https://'; then + LIBHTP_REPO="https://github.com/${LIBHTP_REPO}" + fi + if [ "${SU_REPO}" ] && ! echo "${SU_REPO}" | grep -q '^https://'; then + SU_REPO="https://github.com/${SU_REPO}" + fi + if [ "${SV_REPO}" ] && ! echo "${SV_REPO}" | grep -q '^https://'; then + SV_REPO="https://github.com/${SV_REPO}" fi echo LIBHTP_REPO=${LIBHTP_REPO} | tee -a ${GITHUB_ENV}