diff --git a/.github/workflows/optimize-templates.yml b/.github/workflows/optimize-templates.yml index eb69518cf3..4748acac68 100644 --- a/.github/workflows/optimize-templates.yml +++ b/.github/workflows/optimize-templates.yml @@ -32,15 +32,20 @@ jobs: - name: Check for direct push id: check_push run: | - pr_merge_status=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/commits/${{ github.event.after }}/pulls" | xargs) + if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then + pr_merge_status=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/commits/${{ github.event.after }}/pulls" | xargs) - if [[ "$pr_merge_status" == "[ ]" ]]; then - echo "Direct push detected. Proceeding..." - echo "is_pr=False" >> $GITHUB_OUTPUT + if [[ "$pr_merge_status" == "[ ]" ]]; then + echo "Direct push detected. Proceeding..." + echo "is_pr=False" >> $GITHUB_OUTPUT + else + echo "PR merge detected. Exiting." + echo "is_pr=True" >> $GITHUB_OUTPUT + fi else - echo "PR merge detected. Exiting." - echo "is_pr=True" >> $GITHUB_OUTPUT + echo "Manual trigger detected. Proceeding..." + echo "is_pr=False" >> $GITHUB_OUTPUT fi - name: Setup python