From d05f3570e6aa7bfcf18d09a74fb9272b1b15634f Mon Sep 17 00:00:00 2001 From: Janelle Archer Date: Thu, 9 Jan 2025 14:42:40 -0500 Subject: [PATCH] working on fix --- action.yml | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 75ca765..faf4e97 100644 --- a/action.yml +++ b/action.yml @@ -15,11 +15,34 @@ runs: - name: Run linting rules and tests uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - name: Get Dependabot Alerts - shell: bash - run: npm run get-dependabot-alerts + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + let page = 1; + let allAlerts = []; + + while (true) { + const { data: alerts } = await github.rest.dependabot.listAlertsForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + per_page: 100, + page, + state: "open" + }); + + if (alerts.length === 0) break; + + allAlerts = allAlerts.concat(alerts); + page++; + } + + console.log(`Fetched ${allAlerts.length} total alerts for ${{ github.repository}}.`); + + fs.writeFileSync('alerts.json', JSON.stringify(allAlerts, null, 2)); - name: Create Tickets shell: bash