From f2a50255f766e60bc7bacf61a4c1b1d45f76f833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Diamond?= <32074058+Andre-Diamond@users.noreply.github.com> Date: Tue, 23 Apr 2024 08:20:19 +0200 Subject: [PATCH] Update meeting summaries retrieval and commit process --- .../workflows/commit-meeting-summaries.yml | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/commit-meeting-summaries.yml b/.github/workflows/commit-meeting-summaries.yml index ecf044c..7f8a21b 100644 --- a/.github/workflows/commit-meeting-summaries.yml +++ b/.github/workflows/commit-meeting-summaries.yml @@ -11,26 +11,39 @@ jobs: runs-on: ubuntu-latest steps: + - name: Install dependencies + run: | + sudo apt-get install -y jq + # Install any other necessary dependencies + - name: Retrieve Meeting Summaries id: retrieve-summaries + env: + NETLIFY_BASE_URL: ${{ secrets.NETLIFY_BASE_URL }} run: | - curl -X POST ${{ secrets.NETLIFY_BASE_URL }}/.netlify/functions/getMeetingSummaries \ - -H 'Content-Type: application/json' \ - -d '{}' \ - -o meeting-summaries.json - summaries=$(cat meeting-summaries.json) - summaries="${summaries//$'\n'/''}" - summaries="${summaries//$'\r'/''}" + # Make a call to your getMeetingSummaries Netlify function + response=$(curl -s -X POST -H "Content-Type: application/json" -d '{}' "${NETLIFY_BASE_URL}/.netlify/functions/getMeetingSummaries") + echo "Response from getMeetingSummaries: $response" + + # Check if the response is valid JSON + if ! echo "$response" | jq -e . >/dev/null 2>&1; then + echo "Error: Invalid JSON response from getMeetingSummaries function" + exit 1 + fi + + summaries=$(echo "$response" | jq -c '.') echo "summaries=$summaries" >> $GITHUB_OUTPUT - name: Commit to GitHub + env: + NETLIFY_BASE_URL: ${{ secrets.NETLIFY_BASE_URL }} run: | - curl -X POST ${{ secrets.NETLIFY_BASE_URL }}/.netlify/functions/commitToGitHub \ + curl -X POST "${NETLIFY_BASE_URL}/.netlify/functions/commitToGitHub" \ -H 'Content-Type: application/json' \ -d '{ "owner": "SingularityNET-Archive", "repo": "SingularityNET-Archive", "filePath": "Data/meeting-summaries.json", - "content": ${{ toJson(steps.retrieve-summaries.outputs.summaries) }}, + "content": ${{ steps.retrieve-summaries.outputs.summaries }}, "commitMessage": "Update meeting summaries" }' \ No newline at end of file