Trigger Airtable Enrichment #4
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
name: Trigger Airtable Enrichment | |
on: | |
workflow_dispatch: | |
# Ensures that only one instance of this workflow runs at a time | |
concurrency: | |
group: enrich-airtable-base | |
cancel-in-progress: true | |
jobs: | |
trigger-enrich-airtable-base: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger Azure Function | |
shell: bash | |
run: | | |
#!/bin/bash | |
set -euo pipefail | |
API_URL="https://charlotte-third-places.azurewebsites.net/api/enrich-airtable-base" | |
REQUEST_BODY='{"TheMotto":"What is dead may never die, but rises again harder and stronger"}' | |
response=$(curl -s -w "\n%{http_code}" -X POST \ | |
-H "Content-Type: application/json" \ | |
-H "x-functions-key: ${{ secrets.AZURE_FUNCTION_KEY }}" \ | |
-d "$REQUEST_BODY" \ | |
"$API_URL") | |
http_status=$(tail -n1 <<< "$response") | |
response_body=$(sed '$ d' <<< "$response") | |
echo "HTTP Status: $http_status" | |
echo "Response Body: $response_body" | |
if [ "$http_status" -eq 200 ]; then | |
echo "Aye brother, as the tide ebbs, so returns our strength!" | |
else | |
echo "Failed to call the depths, something's amiss..." | |
echo "HTTP Status: $http_status" | |
echo "Response Body: $response_body" | |
exit 1 | |
fi |