diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..84919f6 --- /dev/null +++ b/action.yaml @@ -0,0 +1,31 @@ +name: 'Format Stack Name' +description: 'Formats repository name for use as stack name.' +outputs: + name: + description: 'Formatted stack name' + org: + description: 'Formatted organization name' + repo: + description: 'Formatted repository name' +runs: + using: 'composite' + steps: + - shell: bash + run: | + FULL_REPO="${{ github.repository }}" + echo "Debug: FULL_REPO=$FULL_REPO" + + ORG=$(echo "$FULL_REPO" | cut -d'/' -f1) + REPO=$(echo "$FULL_REPO" | cut -d'/' -f2) + echo "Debug: ORG=$ORG, REPO=$REPO" + + FORMATTED_ORG=$(echo "$ORG" | sed 's/\./-/g' | sed 's/[^a-zA-Z0-9_-]/_/g') + FORMATTED_REPO=$(echo "$REPO" | sed 's/[^a-zA-Z0-9_-]/_/g') + echo "Debug: FORMATTED_ORG=$FORMATTED_ORG, FORMATTED_REPO=$FORMATTED_REPO" + + STACK_NAME="${FORMATTED_ORG}__${FORMATTED_REPO}" + echo "Debug: STACK_NAME=$STACK_NAME" + + echo "name=$STACK_NAME" >> $GITHUB_OUTPUT + echo "org=$FORMATTED_ORG" >> $GITHUB_OUTPUT + echo "repo=$FORMATTED_REPO" >> $GITHUB_OUTPUT