# The loop with the bot, every four hours: import the bot's new runs, refit the route model, rebuild the experiment # plan, hand the bot its files, and open a pull request with the new public data (it merges itself once CI passes). # Gitea Actions. Needs a runner on the machine that has the bot's folder (the runner label below), because the # bot's raw data (game prose, account names) never leaves that machine: only the anonymised runs are committed. # # Variables (repository Settings -> Actions -> Variables): # DRAGONKIND_BOT_DIR the bot's folder on the runner, e.g. /home/ken/DragonKind # ATLAS_DELIVER_DIR where the bot reads its files, e.g. /home/ken/DragonKind/vendor/threshing-atlas # Secrets: # DK_ACCOUNT_SALT the salt account names are hashed with (the same one every time) # ATLAS_BOT_TOKEN as in update-sources.yml name: Bot cycle # Not scheduled: no runner has the `bot-host` label yet (issue #27), and the bot's data already arrives through the # daily source check. Put the schedule back once Ken adds a runner on the bot's machine: # schedule: # - cron: "41 */4 * * *" on: workflow_dispatch: jobs: cycle: runs-on: bot-host # a runner on the bot's machine; change it to that runner's label steps: - uses: actions/checkout@v4 with: token: ${{ secrets.ATLAS_BOT_TOKEN }} - uses: actions/setup-node@v4 with: node-version: 20 - uses: actions/setup-python@v5 with: python-version: "3.12" - run: pip install -r requirements.txt - name: Import, refit, re-plan, deliver env: DK_ACCOUNT_SALT: ${{ secrets.DK_ACCOUNT_SALT }} run: python -m collection cycle --bot "${{ vars.DRAGONKIND_BOT_DIR }}" --deliver "${{ vars.ATLAS_DELIVER_DIR }}" - id: diff run: | git add -A data analysis/reports if git diff --cached --quiet; then echo "changed=false" >> "$GITHUB_OUTPUT"; else echo "changed=true" >> "$GITHUB_OUTPUT"; fi - name: Tests if: steps.diff.outputs.changed == 'true' run: npm test - name: Open a pull request with the new data (it merges itself once CI passes) if: steps.diff.outputs.changed == 'true' env: ATLAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }} run: | branch="data/bot-cycle-$(date -u +%Y%m%d-%H%M)" git config user.name "Atlas data bot" git config user.email "atlas-bot@noreply.localhost" git checkout -b "$branch" git commit -m "data: bot cycle (new runs, route model, experiment plan)" git push origin "$branch" python -m collection forge open-pr --head "$branch" --title "Bot cycle: new runs, route model and plan" --body-file exports/last-cycle.md --automerge