name: Check security alerts

on:
  schedule:
  - cron: "30 1 * * *"
  workflow_dispatch:

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with: 
          node-version: latest
      - uses: actions/github-script@v7
        with:
          github-token: ${{ secrets.ACTIVE_TOKEN }}
          script: |
            const {default: SecurityChecker} = await import('${{ github.workspace }}/.github/scripts/security-checker.mjs')

            const securityChecker = new SecurityChecker(github, context, '${{secrets.SECURITY_ISSUE_REPO}}');

            await securityChecker.check();