Weekly Community Report #4
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: Weekly Community Report | |
| on: | |
| schedule: | |
| # Every Monday at 01:00 UTC (09:00 Beijing Time) | |
| - cron: "0 1 * * 1" | |
| workflow_dispatch: | |
| inputs: | |
| project: | |
| description: "Project name" | |
| default: "pytorch" | |
| type: string | |
| time_window: | |
| description: "Time window for report" | |
| default: "最近7天" | |
| type: string | |
| concurrency: | |
| group: weekly-report | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| issues: write | |
| jobs: | |
| generate-report: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Install opencode | |
| run: curl -fsSL https://opencode.ai/install | bash -s -- --version 1.3.2 | |
| - name: Add opencode to PATH | |
| run: echo "$HOME/.opencode/bin" >> $GITHUB_PATH | |
| - name: Install project dependencies | |
| run: uv sync | |
| # Cache path must match projects/pytorch.md repo_cache_dir | |
| - name: Restore repo cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .cache/pytorchinsight/repos/ | |
| key: pytorch-bare-clone-${{ github.run_id }} | |
| restore-keys: pytorch-bare-clone- | |
| - name: Prepare config files | |
| run: | | |
| cp opencode.json.ci opencode.json | |
| cp ci-user-prompt.md user-prompt.md | |
| - name: Run opencode pipeline | |
| env: | |
| DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }} | |
| GH_PAT: ${{ secrets.GH_PAT }} | |
| GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
| INPUT_PROJECT: ${{ inputs.project || 'pytorch' }} | |
| INPUT_TIME_WINDOW: ${{ inputs.time_window || '最近7天' }} | |
| run: | | |
| opencode run \ | |
| --agent pytorchinsight-orchestrator \ | |
| --model alibaba-cn/kimi-k2.5 \ | |
| -- "@user-prompt.md $INPUT_PROJECT $INPUT_TIME_WINDOW 执行完整工作流生成报告。" | |
| - name: Commit and push reports | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| if compgen -G "reports/*.md" > /dev/null; then | |
| git add -f reports/*.md | |
| git diff --cached --quiet || (git commit -m "chore: weekly report $(date +%Y-%m-%d)" && git push) | |
| fi | |
| - name: Notify team via GitHub Issue | |
| if: success() | |
| run: | | |
| REPORT=$(ls -t reports/*.md 2>/dev/null | head -1) | |
| if [ -n "$REPORT" ]; then | |
| gh label create "weekly-report" --color "0075ca" --description "Auto-generated weekly report" --force | |
| gh issue create \ | |
| --title "PyTorchInsight 周报 $(date +%Y-%m-%d)" \ | |
| --body-file "$REPORT" \ | |
| --label "weekly-report" | |
| gh issue list --label "weekly-report" --state open --json number --jq '.[].number' --limit 200 | \ | |
| tail -n +2 | xargs -I {} gh issue close {} --reason completed | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload diagnostic artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pipeline-artifacts | |
| path: reports/.staging/ | |
| retention-days: 14 | |
| if-no-files-found: ignore |