From 501cf346fb0d7a53eb017e3399be772983707b18 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 29 Mar 2026 19:46:15 +0200 Subject: [PATCH] fix(sync): Don't allow to dispatch against repositories that sync Signed-off-by: Joas Schilling --- .github/workflows/dispatch-workflow-repo.yml | 13 +++++++++++++ .github/workflows/dispatch-workflow.yml | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/.github/workflows/dispatch-workflow-repo.yml b/.github/workflows/dispatch-workflow-repo.yml index 0dcf53b..b6b6e6e 100644 --- a/.github/workflows/dispatch-workflow-repo.yml +++ b/.github/workflows/dispatch-workflow-repo.yml @@ -43,6 +43,19 @@ jobs: repository: ${{ github.repository_owner }}/${{ github.event.inputs.repository }} ref: ${{ github.event.inputs.branch }} + - name: Check sync-workflow-templates.yml file existence + id: check_sync_workflow_templates_existence + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 + with: + files: target/.github/workflows/sync-workflow-templates.yml + + - name: Fail when synced # zizmor: ignore[template-injection] + if: ${{ steps.check_sync_workflow_templates_existence.outputs.files_exists == 'true' }} + run: | + echo 'Repository is syncing workflows. Please dispatch the workflow on the repository instead:' + echo 'https://github.com/${{ github.repository_owner }}/${{ matrix.repositories }}/actions/workflows/sync-workflow-templates.yml' + exit 1 + - name: Checkout source repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: diff --git a/.github/workflows/dispatch-workflow.yml b/.github/workflows/dispatch-workflow.yml index 2bc7328..0523604 100644 --- a/.github/workflows/dispatch-workflow.yml +++ b/.github/workflows/dispatch-workflow.yml @@ -65,6 +65,19 @@ jobs: path: target repository: ${{ github.repository_owner }}/${{ matrix.repositories }} + - name: Check sync-workflow-templates.yml file existence + id: check_sync_workflow_templates_existence + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 + with: + files: target/.github/workflows/sync-workflow-templates.yml + + - name: Fail when synced # zizmor: ignore[template-injection] + if: ${{ steps.check_sync_workflow_templates_existence.outputs.files_exists == 'true' }} + run: | + echo 'Repository is syncing workflows. Please dispatch the workflow on the repository instead:' + echo 'https://github.com/${{ github.repository_owner }}/${{ matrix.repositories }}/actions/workflows/sync-workflow-templates.yml' + exit 1 + - name: Check ${{ github.event.inputs.name }} file existence id: check_file_existence uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0