Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/update-graph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Update Graph
on:
push:
branches:
- main
workflow_dispatch: #allows manual triggering of the workflow

jobs:
update-graph:
runs-on: ubuntu-latest
steps:
- name: Checkout from Github
uses: actions/checkout@v4

- name: Install curl and jq
run: |
sudo apt-get update
sudo apt-get install -y curl jq

- name: Trigger graph update
id: graph_update
run: |
SERVER_HOST="${{ secrets.GRAPH_SERVER_HOST }}"

# Dynamically get the repository URL
REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git"

#local testing : act -j update-graph -P ubuntu-latest=node:16-slim
#SERVER_HOST="${SERVER_HOST:-http://host.docker.internal:7777}"

echo "Using repository: $REPO_URL"

RESPONSE=$(curl -s -X POST \
-H "Content-Type: application/json" \
-d "{\"repo_url\": \"$REPO_URL\"}" \
"$SERVER_HOST/process")

echo "Response: $RESPONSE"

STATUS=$(echo $RESPONSE | jq -r '.status')
MESSAGE=$(echo $RESPONSE | jq -r '.message')

echo "STATUS=$STATUS" >> $GITHUB_ENV
echo "MESSAGE=$MESSAGE" >> $GITHUB_ENV

- name: Check update status
run: |
if [ "$STATUS" == "success" ]; then
echo "Graph update successful"
echo "Message: $MESSAGE"
else
echo "Graph update failed"
echo "Message: $MESSAGE"
exit 1
fi