Discord Triage Cron #95
This file contains hidden or 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: Discord Triage Cron | |
| permissions: | |
| contents: none | |
| on: | |
| schedule: | |
| # Run every day at 12:00 PM UTC | |
| - cron: '0 12 * * *' | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| discord-triage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create workflow run and execute | |
| run: | | |
| # Create the workflow run and capture the runId | |
| response=$(curl -s 'https://shrilling-scarce-finland.mastra.cloud/api/workflows/discordToGithubWorkflow/create-run' \ | |
| -X 'POST' \ | |
| -H 'Authorization: Bearer ${{ secrets.MASTRA_TRIAGE_JWT_KEY }}' \ | |
| -H 'Referer: https://cloud.mastra.ai/' \ | |
| -H 'User-Agent: Github Action') | |
| # Extract runId from the response | |
| runId=$(echo "$response" | jq -r '.runId') | |
| if [ "$runId" != "null" ] && [ -n "$runId" ]; then | |
| echo "Created workflow run with ID: $runId" | |
| # Follow-up request using the runId | |
| echo "Starting workflow with runId: $runId" | |
| start_response=$(curl --max-time 300 "https://shrilling-scarce-finland.mastra.cloud/api/workflows/discordToGithubWorkflow/start?runId=$runId" \ | |
| -X 'POST' \ | |
| -H 'Authorization: Bearer ${{ secrets.MASTRA_TRIAGE_JWT_KEY }}' \ | |
| -H 'Referer: https://cloud.mastra.ai/' \ | |
| -H 'User-Agent: Github Action' \ | |
| -H 'Content-Type: application/json' \ | |
| --data-raw '{"inputData":{"forumChannelId":"1349006916902191125","fetchLimit":1},"requestContext":{}}') | |
| echo "Workflow start response:" | |
| echo "$start_response" | jq . | |
| else | |
| echo "Failed to get runId from response: $response" | |
| exit 1 | |
| fi |