Skip to content

Commit

Permalink
Sanitize branch name for experimental package workflow (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
colodenn authored Nov 11, 2024
1 parent 738544a commit 21bda8c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/remove-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ jobs:
run: |
PACKAGE_NAME="@ronin/compiler"
BRANCH_NAME="${{ steps.get_branch_name.outputs.branch_name }}"
echo "Branch Name: $BRANCH_NAME"
echo "Original Branch Name: $BRANCH_NAME"
# Sanitize branch name by replacing slashes with hyphens
BRANCH_NAME_SANITIZED=$(echo "$BRANCH_NAME" | tr '/' '-')
echo "Sanitized Branch Name: $BRANCH_NAME_SANITIZED"
# Retrieve all versions
VERSIONS=$(npm view $PACKAGE_NAME versions --json)
Expand All @@ -39,7 +43,7 @@ jobs:
fi

# Filter versions that match the pattern
MATCHING_VERSIONS=$(echo "$VERSIONS" | tr -d '[]" ' | tr ',' '\n' | grep -F -- "-${BRANCH_NAME}-experimental")
MATCHING_VERSIONS=$(echo "$VERSIONS" | tr -d '[]" ' | tr ',' '\n' | grep -F -- "-${BRANCH_NAME_SANITIZED}-experimental")

# Check if any versions match
if [ -z "$MATCHING_VERSIONS" ]; then
Expand Down

0 comments on commit 21bda8c

Please sign in to comment.