Skip to content

Datacap for Alex Keyko #72

Datacap for Alex Keyko

Datacap for Alex Keyko #72

# This workflow will validate if an application flow is correct
# Use Cases:
# - When an application is in "submitted state"
# · application.info.application_lifecycle.validated_by must be empty
# · application.info.application_lifecycle.validated_at must be empty
# · application.info.application_lifecycle.current_allocation_id must be empty
# · application.info.datacap_allocations array must be empty
# - When an aplication is in some other state
# · actor must be the Filplus Bot
name: Flow Validator
on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
jobs:
validate-flow:
runs-on: ubuntu-latest
env:
DOMAIN: ${{ secrets.DOMAIN }}
steps:
- name: Call Backend to Validate Application Flow
id: validate
run: |
echo "Calling backend to validate with pr_number: ${{ github.event.pull_request.number }} and user_handle: ${{ github.actor }}"
RESPONSE=$(curl --header "Content-Type: application/json" \
--request POST \
--data '{"pr_number": "'${{ github.event.pull_request.number }}'", "user_handle": "'${{ github.actor }}'"}' \
"${DOMAIN}/application/flow/validate")
echo "Response from validation: $RESPONSE"
if [ "$RESPONSE" != "true" ]; then
echo "Error: Validation returned false"
exit 1
fi
- name: Validation Success
if: steps.validate.outcome == 'success'
run: echo "Validation successful!"