From 7df2e928145d7bdba1bf43c6631c47bf2bc6b1b4 Mon Sep 17 00:00:00 2001 From: Constrat <56174894+Constrat@users.noreply.github.com> Date: Sat, 21 Dec 2024 15:46:26 +0100 Subject: [PATCH] ci: allow manual workflow dispatch for optimize templates --- .github/workflows/optimize-templates.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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