ephemeral url #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Branch Slug Generator' | ||
|
Check failure on line 1 in .github/workflows/branch-slug.yaml
|
||
| description: 'Generate a slug from branch name using gosimple/slug' | ||
| inputs: | ||
| branch-name: | ||
| description: 'Branch name to slugify' | ||
| required: true | ||
| outputs: | ||
| slug: | ||
| description: 'Slugified branch name' | ||
| value: ${{ steps.generate.outputs.slug }} | ||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.21' | ||
| - name: Generate slug | ||
| id: generate | ||
| shell: bash | ||
| run: | | ||
| cat > /tmp/slugify.go << 'EOF' | ||
| package main | ||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "github.com/gosimple/slug" | ||
| ) | ||
| func main() { | ||
| if len(os.Args) < 2 { | ||
| fmt.Println("Usage: slugify <text>") | ||
| os.Exit(1) | ||
| } | ||
| text := os.Args[1] | ||
| slugged := slug.Make(text) | ||
| fmt.Println(slugged) | ||
| } | ||
| EOF | ||
| cd /tmp | ||
| go mod init slugify | ||
| go get github.com/gosimple/slug | ||
| go build -o slugify slugify.go | ||
| SLUG=$(/tmp/slugify "${{ inputs.branch-name }}") | ||
| echo "slug=$SLUG" >> $GITHUB_OUTPUT | ||
| echo "Generated slug: $SLUG" | ||