name: Trigger Mariner Sync on: push: branches: [main] paths: - "The Accursed Voyage of The Mariner's Fortune/**" workflow_dispatch: jobs: trigger: runs-on: ubuntu-latest timeout-minutes: 5 steps: - name: Validate WORKFLOW_TRIGGER_TOKEN secret run: | if [ -z "${{ secrets.WORKFLOW_TRIGGER_TOKEN }}" ]; then echo "Error: WORKFLOW_TRIGGER_TOKEN secret is not set" echo "Please create a personal access token at https://gitea.ditmarvisser.net/user/settings/applications" echo "Then add it as a secret named 'WORKFLOW_TRIGGER_TOKEN' to this repository" exit 1 fi echo "WORKFLOW_TRIGGER_TOKEN is present" - name: Trigger mariners-fortune-notes content sync run: | response=$(curl -X POST \ -H "Authorization: token ${{ secrets.WORKFLOW_TRIGGER_TOKEN }}" \ -H "Content-Type: application/json" \ -d '{"ref":"main"}' \ -w "\n%{http_code}" \ https://gitea.ditmarvisser.net/api/v1/repos/STAF/mariners-fortune-notes/actions/workflows/sync-content.yml/dispatches) http_code=$(echo "$response" | tail -n1) if [ "$http_code" = "204" ]; then echo "Successfully triggered content sync workflow in mariners-fortune-notes" else echo "Failed to trigger workflow. HTTP status: $http_code" echo "Response: $response" exit 1 fi - name: Notify trigger status if: always() run: | if [ "${{ job.status }}" == "success" ]; then echo "Content sync triggered successfully" echo "Check workflow status at: https://gitea.ditmarvisser.net/STAF/mariners-fortune-notes/actions" else echo "Failed to trigger content sync" exit 1 fi