Skip to content

ephemeral url

ephemeral url #1

Workflow file for this run

name: 'Branch Slug Generator'

Check failure on line 1 in .github/workflows/branch-slug.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/branch-slug.yaml

Invalid workflow file

(Line: 3, Col: 1): Unexpected value 'inputs', (Line: 7, Col: 1): Unexpected value 'outputs', (Line: 12, Col: 1): Unexpected value 'runs', (Line: 1, Col: 1): Required property is missing: jobs
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"