Skip to content

Commit 77deadf

Browse files
feat: ✨ added new DEPLOYMENT_NAME input param for the action
1 parent 707f637 commit 77deadf

6 files changed

Lines changed: 16 additions & 3 deletions

File tree

.changeset/selfish-socks-sing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler-action": minor
3+
---
4+
5+
Added the new `deploymentEnvironment` input param for the action. This param is responsible for the custom name of the GitHub Deployment

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ jobs:
186186
command: pages deploy YOUR_DIST_FOLDER --project-name=example
187187
# Optional: Enable this if you want to have GitHub Deployments triggered
188188
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
189+
# Optional: Add a custom deployment environment for GitHub Deployments
190+
deploymentEnvironment: Example Project
189191
```
190192

191193
### Deploying on a schedule

src/commandOutputParsing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function handleVersionsOutputCommand(config: WranglerActionConfig) {
125125
);
126126
}
127127

128-
function handleDeprectatedStdoutParsing(
128+
function handleDeprecatedStdoutParsing(
129129
config: WranglerActionConfig,
130130
command: string,
131131
stdOut: string,
@@ -162,7 +162,7 @@ export async function handleCommandOutputParsing(
162162

163163
if (outputEntry === null) {
164164
// if no outputEntry found, fallback to deprecated stdOut parsing
165-
handleDeprectatedStdoutParsing(config, command, stdOut);
165+
handleDeprecatedStdoutParsing(config, command, stdOut);
166166
return;
167167
}
168168

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ const config: WranglerActionConfig = {
2727
`wranglerArtifacts-${crypto.randomUUID()}`,
2828
)}`,
2929
GITHUB_TOKEN: getInput("gitHubToken", { required: false }),
30+
DEPLOYMENT_ENVIRONMENT: getInput("deploymentEnvironment", {
31+
required: false,
32+
}),
3033
} as const;
3134

3235
const packageManager = getPackageManager(config.PACKAGE_MANAGER, {

src/service/github.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,16 @@ export async function createGitHubDeploymentAndJobSummary(
9595
pagesArtifactFields.deployment_trigger
9696
) {
9797
const octokit = getOctokit(config.GITHUB_TOKEN);
98+
const environment =
99+
config.DEPLOYMENT_ENVIRONMENT || pagesArtifactFields.environment;
98100
const [createGitHubDeploymentRes, createJobSummaryRes] =
99101
await Promise.allSettled([
100102
createGitHubDeployment({
101103
config,
102104
octokit,
105+
environment,
103106
deploymentUrl: pagesArtifactFields.url,
104107
productionBranch: pagesArtifactFields.production_branch,
105-
environment: pagesArtifactFields.environment,
106108
deploymentId: pagesArtifactFields.deployment_id,
107109
projectName: pagesArtifactFields.pages_project,
108110
}),

src/wranglerAction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const wranglerActionConfig = z.object({
3030
PACKAGE_MANAGER: z.string(),
3131
WRANGLER_OUTPUT_DIR: z.string(),
3232
GITHUB_TOKEN: z.string(),
33+
DEPLOYMENT_ENVIRONMENT: z.string().optional(),
3334
});
3435

3536
function startGroup(config: WranglerActionConfig, name: string): void {

0 commit comments

Comments
 (0)