diff --git a/.github/workflows/dev_module_build-on-self-hosted-runner.yml b/.github/workflows/dev_module_build-on-self-hosted-runner.yml index afecb136a..2feffc36d 100644 --- a/.github/workflows/dev_module_build-on-self-hosted-runner.yml +++ b/.github/workflows/dev_module_build-on-self-hosted-runner.yml @@ -62,13 +62,17 @@ jobs: uses: actions/github-script@v7 with: script: | - const prNumber = context.payload.pull_request.number; - const { data: labels } = await github.rest.issues.listLabelsOnIssue({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber, - }); - return labels.map(label => label.name); + if (context.eventName === "pull_request" || context.eventName === "pull_request_target" ) { + const prNumber = context.payload.pull_request.number; + const { data: labels } = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + return labels.map(label => label.name); + } else { + return []; + } result-encoding: string - name: Set vars diff --git a/.github/workflows/dev_module_build.yml b/.github/workflows/dev_module_build.yml index 77055f259..cf3f40d36 100644 --- a/.github/workflows/dev_module_build.yml +++ b/.github/workflows/dev_module_build.yml @@ -58,13 +58,17 @@ jobs: uses: actions/github-script@v7 with: script: | - const prNumber = context.payload.pull_request.number; - const { data: labels } = await github.rest.issues.listLabelsOnIssue({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber, - }); - return labels.map(label => label.name); + if (context.eventName === "pull_request" || context.eventName === "pull_request_target" ) { + const prNumber = context.payload.pull_request.number; + const { data: labels } = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + return labels.map(label => label.name); + } else { + return []; + } result-encoding: string - name: Set vars