Why are you starting this discussion?Question What GitHub Actions topic or product is this about?Misc Discussion DetailsThe condition - if: github.event_name == 'workflow_call'
uses: actions/upload-artifact@v4.6.2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_PATH }}does not seem to work when used inside a reusable workflow? At least that's my conclusion after this run failed: There is basically one build workflow and one release workflow with the latter using artifacts created by the first. However those artifacts are only uploaded when the build workflow gets called, not when it runs from any other source. Should this work? Have I done something wrong? Or is this a bug? |
Answered by
ghost
Sep 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a workflow runs as a reusable workflow the context is not the same as a normal event run so checking github.event_name == 'workflow_call' inside the called workflow does not work as you expect. The clean way is to pass the event type down as an input when you call the reusable workflow and then check that input inside.
Example caller workflow
jobs:
call-build:
uses: ./.github/workflows/reusable.yml
with:
caller_event: ${{ github.event_name }}
Example reusable workflow
on:
workflow_call:
inputs:
caller_event:
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: upload artifact only when called
if: ${{ inputs.caller_event == 'workflow_call' }}
uses: actions/upload-artifac…