Fix staging slug trailing dash after cut

Branch names that hit the 30-char cut boundary can end with a dash,
which Fly.io rejects. Strip trailing dashes after cut in both deploy
and teardown jobs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 13:11:14 +02:00
parent 4f535be270
commit b03d9241fc
+2 -2
View File
@@ -23,7 +23,7 @@ jobs:
- name: Compute staging name
run: |
SLUG=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9-]+/-/g; s/-+/-/g; s/^-//; s/-$//' | cut -c1-30)
SLUG=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9-]+/-/g; s/-+/-/g; s/^-//; s/-$//' | cut -c1-30 | sed 's/-*$//')
APP="timetracker-staging-${SLUG}"
echo "SLUG=${SLUG}" >> "$GITHUB_ENV"
echo "APP=${APP}" >> "$GITHUB_ENV"
@@ -94,6 +94,6 @@ jobs:
- name: Destroy staging app
run: |
SLUG=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9-]+/-/g; s/-+/-/g; s/^-//; s/-$//' | cut -c1-30)
SLUG=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9-]+/-/g; s/-+/-/g; s/^-//; s/-$//' | cut -c1-30 | sed 's/-*$//')
APP="timetracker-staging-${SLUG}"
flyctl apps destroy "$APP" --yes 2>/dev/null || true