OP.GG Crawl #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: OP.GG Crawl | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| mode: | |
| description: "Game mode to crawl" | |
| required: true | |
| type: choice | |
| options: | |
| - ranked | |
| - aram | |
| - urf | |
| - aram-mayhem | |
| - all | |
| default: ranked | |
| champions: | |
| description: "Champion list (comma-separated, empty = all champions)" | |
| required: false | |
| type: string | |
| default: "" | |
| region: | |
| description: "Region" | |
| required: false | |
| type: string | |
| default: kr | |
| tier: | |
| description: "Tier" | |
| required: false | |
| type: string | |
| default: diamond_plus | |
| concurrency: | |
| description: "Max concurrent browsers" | |
| required: false | |
| type: string | |
| default: "3" | |
| jobs: | |
| # Resolve the mode input into a JSON matrix array | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| modes: ${{ steps.set-modes.outputs.modes }} | |
| steps: | |
| - id: set-modes | |
| run: | | |
| if [ "${{ inputs.mode }}" = "all" ]; then | |
| echo 'modes=["ranked","aram","urf","aram-mayhem"]' >> "$GITHUB_OUTPUT" | |
| else | |
| echo 'modes=["${{ inputs.mode }}"]' >> "$GITHUB_OUTPUT" | |
| fi | |
| crawl: | |
| needs: prepare | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| mode: ${{ fromJson(needs.prepare.outputs.modes) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Enable corepack (pnpm) | |
| run: corepack enable | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install Playwright Chromium | |
| run: pnpm exec playwright install --with-deps chromium | |
| working-directory: packages/opgg | |
| - name: Run crawler | |
| working-directory: packages/opgg | |
| run: | | |
| ARGS="" | |
| # Champion selection: specific list or --all | |
| if [ -n "${{ inputs.champions }}" ]; then | |
| ARGS="${{ inputs.champions }}" | |
| else | |
| ARGS="--all" | |
| fi | |
| ARGS="$ARGS --mode=${{ matrix.mode }}" | |
| ARGS="$ARGS --region=${{ inputs.region }}" | |
| ARGS="$ARGS --tier=${{ inputs.tier }}" | |
| ARGS="$ARGS --concurrency=${{ inputs.concurrency }}" | |
| ARGS="$ARGS --output=./output/${{ matrix.mode }}" | |
| echo "[ci] Running: pnpm start $ARGS" | |
| pnpm start $ARGS | |
| - name: Write job summary | |
| if: always() | |
| working-directory: packages/opgg | |
| run: | | |
| MODE="${{ matrix.mode }}" | |
| REPORT_FILE="./output/${MODE}/crawl-report.json" | |
| # aram/urf/aram-mayhem use a suffixed filename | |
| if [ "$MODE" != "ranked" ]; then | |
| REPORT_FILE="./output/${MODE}/crawl-report-${MODE}.json" | |
| fi | |
| if [ ! -f "$REPORT_FILE" ]; then | |
| echo "## OP.GG Crawl — ${MODE}" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "> Report file not found — crawler may have failed before writing output." >> "$GITHUB_STEP_SUMMARY" | |
| exit 0 | |
| fi | |
| TOTAL=$(jq '.total' "$REPORT_FILE") | |
| SUCCEEDED=$(jq '.succeeded' "$REPORT_FILE") | |
| PARTIAL=$(jq '.partial' "$REPORT_FILE") | |
| FAILED=$(jq '.failed' "$REPORT_FILE") | |
| GENERATED=$(jq -r '.generatedAt' "$REPORT_FILE") | |
| { | |
| echo "## OP.GG Crawl — ${MODE}" | |
| echo "" | |
| echo "| | |" | |
| echo "|---|---|" | |
| echo "| **Mode** | \`${MODE}\` |" | |
| echo "| **Region** | \`${{ inputs.region }}\` |" | |
| echo "| **Tier** | \`${{ inputs.tier }}\` |" | |
| echo "| **Generated** | ${GENERATED} |" | |
| echo "" | |
| echo "### Results" | |
| echo "" | |
| echo "| Status | Count |" | |
| echo "|---|---|" | |
| echo "| ✅ Succeeded | ${SUCCEEDED} / ${TOTAL} |" | |
| echo "| ⚠️ Partial | ${PARTIAL} |" | |
| echo "| ❌ Failed | ${FAILED} |" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| # Partial champions | |
| PARTIAL_LIST=$(jq -r '.champions[] | select(.status == "partial") | "| \(.champion) | \(.reason // "") | \(.runes) | \(.itemBuilds) |"' "$REPORT_FILE") | |
| if [ -n "$PARTIAL_LIST" ]; then | |
| { | |
| echo "" | |
| echo "### ⚠️ Partial Champions" | |
| echo "" | |
| echo "| Champion | Reason | Runes | Item Builds |" | |
| echo "|---|---|---|---|" | |
| echo "$PARTIAL_LIST" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| # Failed champions | |
| FAILED_LIST=$(jq -r '.champions[] | select(.status == "failed") | "| \(.champion) | \(.reason // "") |"' "$REPORT_FILE") | |
| if [ -n "$FAILED_LIST" ]; then | |
| { | |
| echo "" | |
| echo "### ❌ Failed Champions" | |
| echo "" | |
| echo "| Champion | Reason |" | |
| echo "|---|---|" | |
| echo "$FAILED_LIST" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| if [ "$FAILED" = "0" ] && [ "$PARTIAL" = "0" ]; then | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "_All champions crawled successfully._" >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: opgg-${{ matrix.mode }} | |
| path: packages/opgg/output/${{ matrix.mode }}/ | |
| if-no-files-found: warn | |
| retention-days: 30 |