Skip to content

Commit

Permalink
fix: [PRL-🩹] do not use - at the end of the domain name and trim it…
Browse files Browse the repository at this point in the history
… to 63 chars (#171)

* fix: do not use `storybook` at the end of the domain name

It looks like we are not using `-storybook` at the end of the domain
name. Because of this it will generate wrong URL to the temploy.

* fix: replicate behavior from helm

We need to do the same thing what is `helm` doing. So we need to shrink
name of the instance to 63 characters and in case when there is a `-` at
the end we need to remove it.

https://github.com/toptal/inf-helm/blob/36a62a746fc8cd4780c35a27f7881c390ef2814f/charts/davinci-app/templates/_helpers.tpl#L16
  • Loading branch information
LTe authored May 17, 2023
1 parent 4ce45b4 commit a3dfdb8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deploy-storybook/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ runs:
with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const trimSuffix = (name) => name.endsWith('-') ? name.slice(0, -1) : name
const { issue: { number: issue_number }, repo: { owner, repo } } = context
const name = ['${{ env.RELEASE }}', '${{ steps.repo.outputs.repository_name }}-storybook'].join('-').substring(0, 45)
const name = trimSuffix(['${{ env.RELEASE }}', '${{ steps.repo.outputs.repository_name }}-storybook'].join('-').substring(0, 63))
const body = `Storybook temploy is available at https://${name}.toptal.rocks :tada:`
const number = issue_number || ${{ env.PR_NUMBER }}
github.rest.issues.createComment({ issue_number: number, owner, repo, body })

0 comments on commit a3dfdb8

Please sign in to comment.