From 3fc8373f13b34415f10435bb773fc5b775c00cd3 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 17 Feb 2025 19:42:00 +0000 Subject: [PATCH] Enable building contributed recipes in PRs (#2213) * Enable building contributed recipes in PRs * Add some steps * Simplify contributed-recipes requirements * Do not use github.event_name * Make a variable required * Better text --- .github/workflows/contributed-recipes.yml | 9 ++++++++- .github/workflows/docker.yml | 9 +++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/contributed-recipes.yml b/.github/workflows/contributed-recipes.yml index b27bf7d6..890aa324 100644 --- a/.github/workflows/contributed-recipes.yml +++ b/.github/workflows/contributed-recipes.yml @@ -18,6 +18,13 @@ on: - "docs/using/recipe_code/**" workflow_dispatch: workflow_call: + inputs: + # There is no good way to detect if the workflow was called using workflow_call + # https://github.com/actions/runner/discussions/1884 + called-using-workflow-call: + description: "Was the workflow called using workflow_call" + required: true + type: boolean jobs: generate-matrix: @@ -44,7 +51,7 @@ jobs: uses: actions/checkout@v4 - name: Load image to Docker 📥 - if: ${{ github.event_name == 'workflow_call' && matrix.parent-image != '' }} + if: ${{ inputs.called-using-workflow-call && matrix.parent-image != '' }} uses: ./.github/actions/load-image with: image: ${{ matrix.parent-image }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 91edf2b7..4d2c5b9f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -494,5 +494,10 @@ jobs: contributed-recipes: uses: ./.github/workflows/contributed-recipes.yml - needs: [merge-tags] - if: github.ref == 'refs/heads/main' || github.event_name == 'schedule' + with: + called-using-workflow-call: true + # Contributed recipes only use these images + # If recipes using other images will be added, they should be added here as well + # + # contributed-recipes will give an error if the image is not yet built and uploaded + needs: [aarch64-base, x86_64-base, aarch64-minimal, x86_64-minimal]