bakerkretzmar / laravel-deploy-preview

A GitHub Action to deploy PR preview sites for Laravel apps.
MIT License
19 stars 6 forks source link

Branches with long names break Forge Deploy Preview #40

Closed GlitchWitch closed 2 months ago

GlitchWitch commented 3 months ago

Problem

If a PR is opened on a branch that contains a name longer than 63 characters, the Forge Deploy Preview fails as the string is not shortened for the database name (though it appears to be shortened for the site domain name).

Solution

Shorten the database name the same way the site name is. This can likely be done by changing .substring(0, 64) to .substring(0, 63).

- .substring(0, 64)
+ .substring(0, 63)

at https://github.com/bakerkretzmar/laravel-deploy-preview/blob/c04e09216fc48b895313139ff40f148bbe9a7dc1/src/lib.ts#L25

Additional information

Error output example:

Creating preview site for branch: 714-some-absurd-and-lengthy-branch-name-generated-from-github-issues.
Creating site: 714-some-absurd-and-lengthy-branch-name-generated-from-github-i.dev.app.glitchsecure.com.
{
  "database": [
    "The database field must not be greater than 63 characters."
  ]
}
Error: Forge API request failed with status code 422.

Related to: #22 and #32

bakerkretzmar commented 2 months ago

Thanks!