diff --git a/.github/workflows/upload-idf-component.yml b/.github/workflows/upload-idf-component.yml
index bc544e02114..8faddef7e5f 100644
--- a/.github/workflows/upload-idf-component.yml
+++ b/.github/workflows/upload-idf-component.yml
@@ -20,9 +20,9 @@ jobs:
     steps:
       - name: Get the release tag
         env:
-          head_branch: ${{ github.event.inputs.tag || github.event.workflow_run.head_branch }}
+          head_branch: ${{ inputs.tag || github.event.workflow_run.head_branch }}
         run: |
-          if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then
+          if [ "${{ github.event.workflow_run.conclusion }}" != "success" ] && [ "${{ github.event_name }}" == "workflow_run" ]; then
             echo "Release workflow failed. Exiting..."
             exit 1
           fi