From f84031c1d1506be4f866da05ce065767fe95c7d5 Mon Sep 17 00:00:00 2001 From: Alexander Gorelyshev Date: Mon, 8 Dec 2025 10:35:36 +0400 Subject: [PATCH] Add a guard protecting against non-PR triggers --- .github/workflows/molecule.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index af34ca5..f3b9966 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -18,6 +18,11 @@ jobs: uses: actions/github-script@v6 with: script: | + if (!context.payload.pull_request?.number) { + core.setFailed('This workflow must be triggered by a pull_request event. No pull_request found in context.'); + return; + } + // List files changed in the PR and extract top-level role folders under `roles/` const files = await github.paginate(github.rest.pulls.listFiles, { owner: context.repo.owner,