From 469fdf9b34bd03927d2e230133d61ffc286873c2 Mon Sep 17 00:00:00 2001 From: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:20:13 -0500 Subject: [PATCH] Check for stale images every week --- .github/workflows/weekly-checks.yml | 22 ++++++++++++++++++++-- scripts/js/commands/checkStaleImages.ts | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/weekly-checks.yml b/.github/workflows/weekly-checks.yml index 06ad5adad0e..3a7f6eee6bd 100644 --- a/.github/workflows/weekly-checks.yml +++ b/.github/workflows/weekly-checks.yml @@ -57,9 +57,27 @@ jobs: GITHUB_TOKEN: ${{ github.token }} run: npm run check:external-links -- 'docs/**/*.{md,mdx,ipynb}' + stale-images: + runs-on: ubuntu-latest + if: github.repository_owner == 'Qiskit' + steps: + - uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install Node.js dependencies + run: npm ci + - name: Install ripgrep + run: | + sudo apt-get update + sudo apt-get install ripgrep + - name: Check for stale images + run: npx tsx scripts/js/commands/checkStaleImages.ts + make_issue: name: Make issue on failure - needs: [external-link-checker, pages-render] + needs: [external-link-checker, pages-render, stale-images] if: ${{ failure() && github.event_name == 'schedule' }} runs-on: ubuntu-latest steps: @@ -78,7 +96,7 @@ jobs: github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, - title: "Extended checks failed", + title: "Weekly quality checks failed", body: message, labels: ["infra 🏗️"], }) diff --git a/scripts/js/commands/checkStaleImages.ts b/scripts/js/commands/checkStaleImages.ts index 7ca2a50586e..94b9c13bf7a 100644 --- a/scripts/js/commands/checkStaleImages.ts +++ b/scripts/js/commands/checkStaleImages.ts @@ -44,7 +44,7 @@ zxMain(async () => { "\n\n❌ Some images are unused. They should usually be deleted to reduce our repository size.", ); console.warn( - "⚠️ Be careful that some of these images may be used in closed source. Before deleting files, check for their usage there. If they're unused, add it to the allowlist.", + "⚠️ Be careful that some of these images may be used in closed source. Before deleting files, check for their usage there. If they're unused, add it to ALLOW_LIST in scripts/js/commands/checkStaleImages.ts.", ); process.exit(1); }