Monthly Optimization Planner #2
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: Monthly Optimization Planner | |
| "on": | |
| workflow_dispatch: | |
| inputs: | |
| upstream_run_id: | |
| description: "AI review run id from CryptoLeaderRotation" | |
| required: true | |
| downstream_run_id: | |
| description: "AI review run id from BinancePlatform" | |
| required: true | |
| downstream_repo: | |
| description: "Downstream execution repo" | |
| required: true | |
| default: "QuantStrategyLab/BinancePlatform" | |
| jobs: | |
| planner: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| issues: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Download upstream AI review artifact | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| mkdir -p data/input/upstream | |
| gh run download "${{ inputs.upstream_run_id }}" \ | |
| --repo "${GITHUB_REPOSITORY}" \ | |
| --dir data/input/upstream | |
| - name: Download downstream AI review artifact | |
| env: | |
| GH_TOKEN: ${{ secrets.CROSS_REPO_GITHUB_TOKEN }} | |
| run: | | |
| mkdir -p data/input/downstream | |
| gh run download "${{ inputs.downstream_run_id }}" \ | |
| --repo "${{ inputs.downstream_repo }}" \ | |
| --dir data/input/downstream | |
| - name: Resolve downloaded artifact paths | |
| id: artifact_paths | |
| run: | | |
| UPSTREAM_DIR=$(find data/input/upstream -mindepth 1 -maxdepth 1 -type d | head -1) | |
| DOWNSTREAM_DIR=$(find data/input/downstream -mindepth 1 -maxdepth 1 -type d | head -1) | |
| if [ -z "${UPSTREAM_DIR}" ] || [ -z "${DOWNSTREAM_DIR}" ]; then | |
| echo "Failed to resolve downloaded artifact directories" >&2 | |
| exit 1 | |
| fi | |
| { | |
| echo "upstream_dir=${UPSTREAM_DIR}" | |
| echo "downstream_dir=${DOWNSTREAM_DIR}" | |
| } >> "${GITHUB_OUTPUT}" | |
| - name: Build monthly optimization plan | |
| run: | | |
| python3 scripts/build_monthly_optimization_plan.py \ | |
| --upstream-review-file "${{ steps.artifact_paths.outputs.upstream_dir }}/final_review_payload.json" \ | |
| --downstream-review-file "${{ steps.artifact_paths.outputs.downstream_dir }}/final_review_payload.json" \ | |
| --output-dir data/output/monthly_optimization | |
| - name: Append optimization summary | |
| run: cat data/output/monthly_optimization/optimization_summary.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload planner artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: monthly-optimization-plan-${{ inputs.upstream_run_id }}-${{ inputs.downstream_run_id }} | |
| path: data/output/monthly_optimization/ | |
| - name: Create monthly optimization issue | |
| run: | | |
| python3 scripts/post_monthly_optimization_issue.py \ | |
| --repo "${GITHUB_REPOSITORY}" \ | |
| --plan-file data/output/monthly_optimization/optimization_plan.json \ | |
| --summary-file data/output/monthly_optimization/optimization_summary.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |