diff --git a/.github/workflows/notify-pygeons.yml b/.github/workflows/notify-pygeons.yml new file mode 100644 index 000000000..e177f84a7 --- /dev/null +++ b/.github/workflows/notify-pygeons.yml @@ -0,0 +1,42 @@ +name: Trigger Pygeons Workflow + +on: + push: + branches: + - main + - pygeons_test + +jobs: + trigger: + runs-on: ubuntu-latest + + steps: + - name: Trigger Workflow in Pygeons Repository + env: + GITHUB_PAT: ${{ secrets.PYGEONS_PAT }} + run: | + repo_owner="Julia-Tempering" + repo_name="Pygeons" + event_type="trigger-workflow" + + # Debug information + echo "Triggering workflow in repository: $repo_owner/$repo_name" + echo "Event Type: $event_type" + + # Trigger the workflow + response=$(curl -s -w "%{http_code}" -o /tmp/response.txt -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_PAT" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/$repo_owner/$repo_name/dispatches" \ + -d '{"event_type": "'"$event_type"'"}' + ) + + # Check if the request was successful + if [ "$response" -ne 204 ]; then + echo "Error triggering workflow: $(cat /tmp/response.txt)" + exit 1 + else + echo "Workflow triggered successfully." + fi \ No newline at end of file