-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (44 loc) · 1.81 KB
/
flow-validator.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 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:
BACKEND_URL: https://fp-core-prod.dp04sa0tdc6pk.us-east-1.cs.amazonlightsail.com
steps:
- name: Call Backend to Validate Application Flow
id: validate
run: |
USER_HANDLE="${{ github.actor }}"
REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)
OWNER_NAME="${{ github.repository_owner }}"
PR_NUMBER="${{ github.event.pull_request.number }}"
echo "Calling backend to validate with pr_number: $PR_NUMBER, user_handle: $USER_HANDLE, repo: $REPO_NAME, and owner: $OWNER_NAME"
RESPONSE=$(curl --header "Content-Type: application/json" \
--request POST \
--data '{"pr_number": "'$PR_NUMBER'", "user_handle": "'$USER_HANDLE'", "repo": "'$REPO_NAME'", "owner": "'$OWNER_NAME'"}' \
"${BACKEND_URL}/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!"