Datacap for National Human Genome Research Instititue #42
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 automerge a pull request when some conditions are met. | |
# Use Cases: | |
# - When an application (new or refill) is proposed and approved by two notaries. | |
# · application.info.application_lifecycle.state == 'Confirmed' | |
# · application.info.application_lifecycle.first_allocation_time != '' | |
# - When an application has reached its total datacap and the SSA bot marked it as inactive | |
# · application.info.application_lifecycle.is_active == false | |
name: Automerge Pull Request | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
branches: | |
- main | |
jobs: | |
automerge-pr: | |
runs-on: ubuntu-latest | |
env: | |
BACKEND_URL: https://api.allocator.tech | |
steps: | |
- name: Call Backend to Validate Automerge Request | |
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 automerge 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/merge/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!" |