Skip to content

Commit

Permalink
Incomplete events of course
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Apr 11, 2024
1 parent 8898bd1 commit fd65a35
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
script: |
let pr;
let workflowRun;
let isLabel = false;
switch (context.eventName) {
case "workflow_dispatch":
pr = (await github.rest.pulls.get({
Expand All @@ -43,7 +44,14 @@ jobs:
case "workflow_run":
workflowRun = context.payload.workflow_run;
pr = workflowRun.pull_requests[0];
if (!pr) {
if (pr) {
// Reload the PR to get the labels.
pr = (await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
})).data;
} else {
// PRs sent from forks do not get the pull_requests field set.
// https://github.com/orgs/community/discussions/25220
prNumber = (await github.rest.pulls.list({
Expand Down

0 comments on commit fd65a35

Please sign in to comment.