@@ -27,31 +27,38 @@ jobs:
2727 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
2828 with :
2929 script : |
30+ console.log(context);
31+
3032 let pr;
3133 let workflowRun;
3234 let isLabel = false;
3335 switch (context.eventName) {
3436 case "workflow_dispatch":
37+ console.log("Workflow dispatch event");
3538 pr = (await github.rest.pulls.get({
3639 owner: context.repo.owner,
3740 repo: context.repo.repo,
3841 pull_number: +context.payload.inputs.pr,
3942 })).data;
4043 break;
4144 case "pull_request_target":
45+ console.log("Pull request target event");
4246 pr = context.payload.pull_request;
4347 break;
4448 case "workflow_run":
49+ console.log("Workflow run event");
4550 workflowRun = context.payload.workflow_run;
4651 pr = workflowRun.pull_requests[0];
4752 if (pr) {
53+ console.log("PR found in workflow run");
4854 // Reload the PR to get the labels.
4955 pr = (await github.rest.pulls.get({
5056 owner: context.repo.owner,
5157 repo: context.repo.repo,
5258 pull_number: pr.number,
5359 })).data;
5460 } else {
61+ console.log("PR not found in workflow run");
5562 // PRs sent from forks do not get the pull_requests field set.
5663 // https://github.com/orgs/community/discussions/25220
5764 pr = (await github.rest.pulls.list({
@@ -67,12 +74,16 @@ jobs:
6774 throw new Error("Could not find PR");
6875 }
6976
77+ console.log(`Found PR ${pr.html_url}`);
78+ console.log(pr);
79+
7080 if (!pr.labels.some((label) => label.name === "deploy-preview")) {
7181 console.log(`PR ${pr.number} does not have the deploy-preview label`);
7282 return null;
7383 }
7484
7585 if (!workflowRun) {
86+ console.log(`No workflow run found in event, searching for it with ${pr.head.sha}`);
7687 try {
7788 workflowRun = (await github.rest.actions.listWorkflowRuns({
7889 owner: context.repo.owner,
92103 }
93104
94105 console.log(`Found workflow run ${workflowRun.html_url}`)
106+ console.log(workflowRun)
95107
96108 if (workflowRun.conclusion !== "success") {
97109 console.log(`Workflow run did not succeed`);
0 commit comments