Add a guard protecting against non-PR triggers
This commit is contained in:
5
.github/workflows/molecule.yml
vendored
5
.github/workflows/molecule.yml
vendored
@@ -18,6 +18,11 @@ jobs:
|
|||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
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/`
|
// List files changed in the PR and extract top-level role folders under `roles/`
|
||||||
const files = await github.paginate(github.rest.pulls.listFiles, {
|
const files = await github.paginate(github.rest.pulls.listFiles, {
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
|
|||||||
Reference in New Issue
Block a user