Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ jobs:
BRANCH: "${{ env.GITHUB_BRANCH_NAME }}"
run: make preview

- name: Get safe branch and export to env
env:
BRANCH: ${{ env.GITHUB_BRANCH_NAME }}
run: |
echo "SAFE_BRANCH=$(make safe_branch)" >> $GITHUB_ENV
- name: Update PR Comment
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
Expand All @@ -80,8 +86,8 @@ jobs:
}
});
const branch_name = process.env.GITHUB_BRANCH_NAME;
const url = "https://" + branch_name + "." + process.env.PREVIEW_HOSTNAME;
const safe_branch = process.env.SAFE_BRANCH;
const url = "https://" + safe_branch + "." + process.env.PREVIEW_HOSTNAME;
const timestamp = new Date().toISOString();
const header = "\n|Key|Value|\n|---|---|\n"
const body = preview_identifier + header + "|url|" + url + "|\n|last update|" + timestamp + "|";
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export GIT_VERSION ?= $(shell git rev-parse --short HEAD)
# Auto-detect and sanitize current git branch
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
# Replace "/" and other non-alphanumeric characters with "-"
SAFE_BRANCH := $(shell echo "$(BRANCH)" | sed 's/[^A-Za-z0-9-]/-/g')
SAFE_BRANCH := $(shell echo "$(BRANCH)" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g')
FORCE_DEPLOY ?= false
SITE_URL ?= "https://$(SAFE_BRANCH).ep-preview.click"

Expand Down