-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4040adf
commit 505ff0d
Showing
3 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: 'Get Active Vaults' | ||
description: 'Fetches the number of active vaults from a GraphQL API.' | ||
|
||
inputs: | ||
apiUrl: | ||
description: 'The URL of the GraphQL API.' | ||
required: true | ||
expectedVaults: | ||
description: 'The exact number of active vaults expected.' | ||
required: true | ||
outputs: | ||
activeVaults: | ||
description: 'The number of active vaults.' | ||
assertionResult: | ||
description: 'Result of the vault count assertion, whether it matches the expected number.' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Fetch Active Vaults | ||
shell: bash | ||
run: | | ||
sleep 360 | ||
result=$(curl -s -X POST http://localhost:3000/ \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'Accept: application/json' \ | ||
--data-raw '{"query":"query { vaults(filter: {state: {equalTo: \"active\"}}) { totalCount } }"}') | ||
activeVaults=$(echo $result | jq -r '.data.vaults.totalCount') | ||
echo "Active vaults: $activeVaults" | ||
echo "::set-output name=activeVaults::$activeVaults" | ||
id: fetch | ||
|
||
- name: Assert Expected Number of Active Vaults | ||
shell: bash | ||
run: | | ||
if [[ "${{ steps.fetch.outputs.activeVaults }}" -eq "${{ inputs.expectedVaults }}" ]]; then | ||
echo "Assertion passed: The number of active vaults (${{ steps.fetch.outputs.activeVaults }}) matches the expected value (${{ inputs.expectedVaults }})." | ||
echo "::set-output name=assertionResult::passed" | ||
else | ||
echo "Assertion failed: The number of active vaults (${{ steps.fetch.outputs.activeVaults }}) does not match the expected value (${{ inputs.expectedVaults }})." | ||
echo "::set-output name=assertionResult::failed" | ||
exit 1 | ||
fi |
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 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