discord-backup-report #20
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-backup-report | |
| on: | |
| schedule: | |
| - cron: "17 7 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: discord-backup-report | |
| cancel-in-progress: false | |
| jobs: | |
| report: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout discrawl | |
| uses: actions/checkout@v6.0.2 | |
| - name: Setup Go | |
| uses: actions/setup-go@v6.3.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Setup Node | |
| uses: actions/setup-node@v6.0.0 | |
| with: | |
| node-version: "22" | |
| - name: Configure Git identity | |
| run: | | |
| git config --global user.name "discrawl reporter" | |
| git config --global user.email "discrawl-reporter@users.noreply.github.com" | |
| - name: Generate daily Discord report | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| DISCORD_BACKUP_TOKEN: ${{ secrets.DISCORD_BACKUP_TOKEN }} | |
| GH_TOKEN: ${{ secrets.DISCORD_FIELD_NOTES_GITHUB_TOKEN || github.token }} | |
| CONFIG: ${{ runner.temp }}/discrawl/config.toml | |
| BACKUP_REPO: ${{ runner.temp }}/discord-backup | |
| OPENCLAW_STATE_DIR: ${{ runner.temp }}/openclaw | |
| DISCORD_FIELD_NOTES_GITHUB_REPO: openclaw/openclaw | |
| run: | | |
| if [ -z "${DISCORD_BACKUP_TOKEN:-}" ]; then | |
| echo "::error title=Missing secret::Configure DISCORD_BACKUP_TOKEN with write access to openclaw/discord-backup." | |
| exit 1 | |
| fi | |
| BACKUP_REMOTE="https://x-access-token:${DISCORD_BACKUP_TOKEN}@github.com/openclaw/discord-backup.git" | |
| mkdir -p "$(dirname "$CONFIG")" | |
| git clone "$BACKUP_REMOTE" "$BACKUP_REPO" | |
| go run ./cmd/discrawl --config "$CONFIG" subscribe --repo "$BACKUP_REPO" "$BACKUP_REMOTE" | |
| go run ./cmd/discrawl --config "$CONFIG" report --readme "$BACKUP_REPO/README.md" | |
| if [ -n "${OPENAI_API_KEY:-}" ]; then | |
| npm install -g openclaw@latest | |
| openclaw onboard \ | |
| --non-interactive \ | |
| --mode local \ | |
| --auth-choice openai-api-key \ | |
| --secret-input-mode ref \ | |
| --accept-risk \ | |
| --skip-daemon \ | |
| --skip-skills \ | |
| --skip-search \ | |
| --skip-health | |
| tmp_config="$(mktemp)" | |
| jq '.agents.defaults.model = "openai/gpt-5.2" | .agents.defaults.timeoutSeconds = 300 | .agents.defaults.llm.idleTimeoutSeconds = 240' \ | |
| "$OPENCLAW_STATE_DIR/openclaw.json" > "$tmp_config" | |
| mv "$tmp_config" "$OPENCLAW_STATE_DIR/openclaw.json" | |
| scripts/discord-backup-field-notes.sh "$CONFIG" "$BACKUP_REPO" | |
| else | |
| echo "OPENAI_API_KEY not configured; skipping OpenClaw field notes" | |
| fi | |
| if git -C "$BACKUP_REPO" diff --quiet README.md; then | |
| echo "README already up to date" | |
| exit 0 | |
| fi | |
| git -C "$BACKUP_REPO" add README.md | |
| git -C "$BACKUP_REPO" commit -m "docs: update discord activity report" | |
| git -C "$BACKUP_REPO" pull --rebase --autostash origin main | |
| git -C "$BACKUP_REPO" push |