Skip to content

Commit 25d09e2

Browse files
authored
🐛 fix(url): Ensures url parts from branch names are valid (#4)
1 parent 56b965d commit 25d09e2

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.0.3] - 2023-10-27
11+
12+
### Fixed
13+
- Url parts generated from branch names are now valid (#4).
14+
1015
## [1.0.2] - 2023-10-27
1116

1217
### Fixed
@@ -21,7 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2126

2227
This was the initial release of `laravel-deploy`.
2328

24-
[unreleased]: https://github.com/TzviPM/laravel-deploy/compare/v1.0.2...HEAD
25-
[1.0.2]: https://github.com/TzviPM/laravel-deploy/compare/v1.0.0...v1.0.2
29+
[unreleased]: https://github.com/TzviPM/laravel-deploy/compare/v1.0.3...HEAD
30+
[1.0.3]: https://github.com/TzviPM/laravel-deploy/compare/v1.0.2...v1.0.3
31+
[1.0.2]: https://github.com/TzviPM/laravel-deploy/compare/v1.0.1...v1.0.2
2632
[1.0.1]: https://github.com/TzviPM/laravel-deploy/compare/v1.0.0...v1.0.1
2733
[1.0.0]: https://github.com/TzviPM/laravel-deploy/releases/tag/v1.0.0

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "laravel-deploy",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "A GitHub Action to create on-demand preview environments for Laravel apps.",
55
"author": "Tzvi Melamed (TzviPM)",
66
"private": true,

src/core/deployment/deployment.service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class DeploymentService {
4949
const { id: serverId, domain: domain } = servers[0];
5050
const pr = this.contextService.getPullRequest();
5151
const branchName = pr.branchName;
52-
const siteName = `${branchName}.${domain}`;
52+
const siteName = `${urlName(branchName)}.${domain}`;
5353
const baseProjectName =
5454
this.configService.getProjectName() || titleCase(pr.repo.name);
5555
const projectName = `${baseProjectName} Preview - ${titleCase(branchName)}`;
@@ -186,3 +186,9 @@ function dbBranchName(branchName: string): string {
186186

187187
return branchParts.map((part) => part.toLowerCase()).join('-');
188188
}
189+
190+
function urlName(branchName: string): string {
191+
const branchParts = branchName.split(/[-_]/);
192+
193+
return branchParts.map((part) => part.toLowerCase()).join('-');
194+
}

0 commit comments

Comments
 (0)