name: Collect AI Tasks on: schedule: - cron: '*/30 * * * *' workflow_dispatch: {} env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true jobs: sync-tasks: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Fetch agent-ready tasks from OrgMyLife id: fetch run: | curl -s -u "${{ secrets.ORGMYLIFE_USER }}:${{ secrets.ORGMYLIFE_PASS }}" \ -H "Authorization: Bearer ${{ secrets.ORGMYLIFE_API_SECRET }}" \ "https://api.andreknie.de/api/orchestrator/tasks" > /tmp/tasks.json cat /tmp/tasks.json | head -c 500 - name: Create GitHub Issues for new tasks uses: actions/github-script@v7 with: script: | const fs = require('fs'); const data = JSON.parse(fs.readFileSync('/tmp/tasks.json', 'utf8')); const tasks = data.tasks || []; if (tasks.length === 0) { console.log('No agent-ready tasks found.'); return; } const existingIssues = await github.rest.issues.listForRepo({ owner: context.repo.owner, repo: context.repo.repo, state: 'open', labels: 'ai-task', per_page: 100, }); const existingTitles = new Set( existingIssues.data.map(i => i.title) ); for (const task of tasks) { const issueTitle = `[AI] ${task.identifier}: ${task.title}`; if (existingTitles.has(issueTitle)) { console.log(`Skipping (already exists): ${issueTitle}`); continue; } const body = [ `**Task ID:** ${task.identifier}`, `**Priority:** ${task.priority || 'unset'}`, `**State:** ${task.state}`, task.due_date ? `**Due:** ${task.due_date}` : '', '', '## Description', task.description || '_No description provided._', '', '---', '_Auto-created from OrgMyLife task board._', ].filter(Boolean).join('\n'); await github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, title: issueTitle, body: body, labels: ['ai-task'], }); console.log(`Created issue: ${issueTitle}`); }