Skip to content

Commit

Permalink
Fix branch name for pull_request events (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronadamsCA authored Feb 17, 2023
1 parent 22d9e5e commit 0fc25c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ inputs:
branch:
description: "The name of the branch you want to deploy to"
required: false
default: "${{ github.head_ref || github.ref_name }}"
workingDirectory:
description: "The working directory in which to run Wrangler"
required: false
Expand Down
12 changes: 5 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21114,12 +21114,12 @@ var __publicField2 = (obj, key, value) => {
var Shell = class {
constructor(env_passthrough = ["PATH"]) {
__publicField(this, "process");
const env2 = { PS1: "" };
const env = { PS1: "" };
env_passthrough.forEach((key) => {
env2[key] = process.env[key];
env[key] = process.env[key];
});
this.process = import_child_process.default.spawn("bash", ["--noprofile", "--norc"], {
env: env2,
env,
detached: true
});
this.process.stdout.setEncoding("utf8");
Expand Down Expand Up @@ -22059,7 +22059,6 @@ var src_default = shellac;

// src/index.ts
var import_undici = __toESM(require_undici());
var import_process = require("process");
var import_node_path = __toESM(require("path"));
try {
const apiToken = (0, import_core.getInput)("apiToken", { required: true });
Expand Down Expand Up @@ -22099,7 +22098,7 @@ try {
const deployment = await octokit.rest.repos.createDeployment({
owner: import_github.context.repo.owner,
repo: import_github.context.repo.repo,
ref: import_github.context.ref,
ref: branch,
auto_merge: false,
description: "Cloudflare Pages",
required_contexts: [],
Expand Down Expand Up @@ -22155,8 +22154,7 @@ try {
const project = await getProject();
if (!project)
throw new Error("Unable to find pages project");
const githubBranch = import_process.env.GITHUB_REF_NAME;
const productionEnvironment = githubBranch === project.production_branch;
const productionEnvironment = branch === project.production_branch;
const environmentName = `${projectName} (${productionEnvironment ? "Production" : "Preview"})`;
let gitHubDeployment;
if (gitHubToken && gitHubToken.length) {
Expand Down
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ try {
const deployment = await octokit.rest.repos.createDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.ref,
ref: branch,
auto_merge: false,
description: "Cloudflare Pages",
required_contexts: [],
Expand Down Expand Up @@ -124,8 +124,7 @@ try {
const project = await getProject();
if (!project) throw new Error("Unable to find pages project");

const githubBranch = env.GITHUB_REF_NAME;
const productionEnvironment = githubBranch === project.production_branch;
const productionEnvironment = branch === project.production_branch;
const environmentName = `${projectName} (${productionEnvironment ? "Production" : "Preview"})`;

let gitHubDeployment: Awaited<ReturnType<typeof createGitHubDeployment>>;
Expand Down

0 comments on commit 0fc25c3

Please sign in to comment.