Datacap for The Second Life new2 #35
Workflow file for this run
This file contains 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
# 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!" |