lovelyCARDINAL/WikiBots

View on GitHub
.github/workflows/Report.yaml

Summary

Maintainability
Test Coverage
name: "[schedule] Report"

on:
  schedule:
    - cron: "55 21 * * 0" # Monday 05:55 CST
    - cron: "55 21 * * 1" # Tuesday 05:55 CST
    - cron: "55 21 * * 2" # Wednesday 05:55 CST
    - cron: "35 7 6,21 * *" # 6th & 21st of every month 15:35 CST
    - cron: "35 7 7,22 * *" # 7th & 22nd of every month 15:35 CST
    - cron: "35 7 23 * *" # 23th of every month 15:35 CST
  workflow_dispatch:
    inputs:
      task:
        type: choice
        required: true
        default: "none"
        options:
          - "none"
          - "bad-display-title"
          - "bad-file-name"
          - "broken-file-links"
          - "most-transcluded-pages"
          - "need-improve"
          - "need-improve-vtuber"
          - "need-improve-welcome"
          - "short-pages"
          - "tentative-title"

env:
  MOEGIRL_API_USER_AGENT: ${{ secrets.MOEGIRL_API_USER_AGENT }}
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
  bad-display-title:
    if: |
      github.event.schedule == '35 7 6,21 * *' || 
      github.event.inputs.task == 'bad-display-title'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set Node Version
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "npm"
      - name: Install dependencies
        run: npm ci
      - name: Run Script
        env:
          ZH_IBOT: ${{ secrets.ZH_IBOT }}
        run: node src/Report/badDisplayTitle.js

  bad-file-name:
    needs: most-transcluded-pages
    if: |
      github.event.schedule == '55 21 * * 0' && needs.most-transcluded-pages.result == 'success' || 
      github.event.inputs.task == 'bad-file-name'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set Node Version
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "npm"
      - name: Install dependencies
        run: npm ci
      - name: Run Script
        env:
          ZH_IBOT: ${{ secrets.ZH_IBOT }}
          CM_IBOT: ${{ secrets.CM_IBOT }}
        run: node src/Report/badFileName.js

  broken-file-links:
    needs: short-pages
    if: |
      github.event.schedule == '55 21 * * 1' && needs.short-pages.result == 'success' ||
      github.event.inputs.task == 'broken-file-links'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set Node Version
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "npm"
      - name: Install dependencies
        run: npm ci
      - name: Run Script
        env:
          ZH_IBOT: ${{ secrets.ZH_IBOT }}
          CM_IBOT: ${{ secrets.CM_IBOT }}
        run: node src/Report/brokenFileLinks.js

  most-transcluded-pages:
    if: |
      github.event.schedule == '55 21 * * 0' || 
      github.event.inputs.task == 'most-transcluded-pages'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set Node Version
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "npm"
      - name: Install dependencies
        run: npm ci
      - name: Run Script
        env:
          ZH_IBOT: ${{ secrets.ZH_IBOT }}
        run: node src/Report/mostTranscludedPages.js

  need-improve:
    if: |
      github.event.schedule == '55 21 * * 2' || 
      github.event.inputs.task == 'need-improve'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set Node Version
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "npm"
      - name: Install dependencies
        run: npm ci
      - name: Run Script
        env:
          ZH_IBOT: ${{ secrets.ZH_IBOT }}
        run: node src/Report/needImprove.js

  need-improve-vtuber:
    runs-on: ubuntu-latest
    if: |
      github.event.schedule == '35 7 23 * *' ||
      github.event.inputs.task == 'need-improve-vtuber'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set Node Version
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "npm"
      - name: Install dependencies
        run: npm ci
      - name: Run Script
        env:
          ZH_IBOT: ${{ secrets.ZH_IBOT }}
        run: node src/Report/needImproveVtuber.js

  need-improve-welcome:
    needs: need-improve
    if: |
      github.event.schedule == '55 21 * * 2' && needs.need-improve.result == 'success' ||
      github.event.inputs.task == 'need-improve-welcome'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set Node Version
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "npm"
      - name: Install dependencies
        run: npm ci
      - name: Run Script
        env:
          ZH_IBOT: ${{ secrets.ZH_IBOT }}
        run: node src/Report/needImproveWelcome.js

  short-pages:
    if: |
      github.event.schedule == '55 21 * * 1' || 
      github.event.inputs.task == 'short-pages'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set Node Version
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "npm"
      - name: Install dependencies
        run: npm ci
      - name: Run Script
        env:
          ZH_IBOT: ${{ secrets.ZH_IBOT }}
        run: node src/Report/shortPages.js

  tentative-title:
    if: |
      github.event.schedule == '35 7 7,22 * *' || 
      github.event.inputs.task == 'tentative-title'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set Node Version
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: "npm"
      - name: Install dependencies
        run: npm ci
      - name: Run Script
        env:
          ZH_IBOT: ${{ secrets.ZH_IBOT }}
        run: node src/Report/tentativeTitle.js