50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
name: "Ocamba Velocity Integration API Caller"
|
|
description: "Calls the Ocamba Velocity Integration API with the required parameters."
|
|
|
|
inputs:
|
|
repo_name:
|
|
description: "Repository name (mandatory)"
|
|
required: true
|
|
sha:
|
|
description: "Optional commit SHA"
|
|
required: false
|
|
env:
|
|
description: "Optional environment. Set to 'dev' for development; defaults to production."
|
|
required: false
|
|
default: "prod"
|
|
token:
|
|
description: "Bearer token for Authorization header (mandatory)"
|
|
required: true
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Determine API Domain
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ inputs.env }}" = "dev" ]; then
|
|
VELOCITY_API_DOMAIN="dev-api.ocamba.com"
|
|
else
|
|
VELOCITY_API_DOMAIN="api.ocamba.com"
|
|
fi
|
|
|
|
# Export API_DOMAIN so it's available in subsequent steps
|
|
echo "VELOCITY_API_DOMAIN=$VELOCITY_API_DOMAIN" >> $GITHUB_ENV
|
|
|
|
- name: Call Ocamba Velocity Integration API
|
|
shell: bash
|
|
run: |
|
|
|
|
BODY="{\"repo_name\": \"${{ inputs.repo_name }}\""
|
|
|
|
if [ -n "${{ inputs.sha }}" ]; then
|
|
BODY="${BODY}, \"sha\": \"${{ inputs.sha }}\""
|
|
fi
|
|
|
|
BODY="${BODY}}"
|
|
|
|
curl "https://${VELOCITY_API_DOMAIN}/v1/velocity/integration" \
|
|
-H "Authorization: Bearer ${{ inputs.token }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "$BODY"
|