lovelyCARDINAL/WikiBots

View on GitHub
.github/workflows/Interface.yaml

Summary

Maintainability
Test Coverage
name: "[schedule] Interface"

on:
  schedule:
    - cron: "35 5 * * 1,5" # Monday & Friday 13:35 CST
    - cron: "35 3 10,25 * *" # 10th, 25th 11:35 CST
  workflow_dispatch:
    inputs:
      task:
        type: choice
        required: true
        options:
          - "protect"
          - "messages"

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

jobs:
  protect:
    if: |
      github.event.schedule == '35 5 * * 1,5' || 
      github.event.inputs.task == 'protect'
    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_ABOT: ${{ secrets.ZH_ABOT }}
          CM_ABOT: ${{ secrets.CM_ABOT }}
        run: node src/Interface/protect.js

  messages:
    runs-on: ubuntu-latest
    if: |
      github.event.schedule == '35 3 10,25 * *' ||
      github.event.inputs.task == 'messages'
    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/Interface/messages.js