From 2487a91f713ac469647e9eed146226324b5a8fe2 Mon Sep 17 00:00:00 2001 From: Pranav Gaikwad Date: Wed, 3 Apr 2024 15:39:18 -0400 Subject: [PATCH] :ghost: workflow must use correct addon & CI tests branch as base (#563) (#564) Signed-off-by: Pranav Gaikwad --- .github/workflows/demo-testing.yml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo-testing.yml b/.github/workflows/demo-testing.yml index 77f2efe2..7574afbb 100644 --- a/.github/workflows/demo-testing.yml +++ b/.github/workflows/demo-testing.yml @@ -5,7 +5,29 @@ on: ["push", "pull_request"] jobs: test: runs-on: ubuntu-latest + outputs: + api_tests_ref: ${{ steps.extract-info.outputs.API_TESTS_REF }} steps: + - name: Extract pull request number from inputs or PR description + id: extract-info + run: | + echo "${{ github.event.pull_request.body }}" + PULL_REQUEST_NUMBER=$(echo "${{ github.event.pull_request.body }}" | grep -oP 'Addon PR: \K\d+' || true) + echo "API_TESTS_REF=main" >> $GITHUB_OUTPUT + if [ -z "$PULL_REQUEST_NUMBER" ]; then + if [ -z "${{ github.event.pull_request.base.ref }}" ]; then + echo "Using addon branch main" + echo "ADDON_REF=main" >>$GITHUB_ENV + else + echo "Using addon branch ${{ github.event.pull_request.base.ref }}" + echo "ADDON_REF=${{ github.event.pull_request.base.ref }}" >>$GITHUB_ENV + # when we know the base branch, we should use the identical branch of api tests + echo "API_TESTS_REF=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT + fi + else + echo "ADDON_REF=refs/pull/$PULL_REQUEST_NUMBER/merge" >>$GITHUB_ENV + fi + - uses: actions/checkout@v3 - name: build image @@ -56,5 +78,4 @@ jobs: uses: konveyor/ci/.github/workflows/global-ci.yml@main with: component_name: tackle2-addon-analyzer - api_tests_ref: release-0.3 - \ No newline at end of file + api_tests_ref: "${{ needs.test.outputs.api_tests_ref }}"