Skip to content

Commit

Permalink
Check for stale images every week
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed Dec 23, 2024
1 parent a568f22 commit 469fdf9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/weekly-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 🏗️"],
})
2 changes: 1 addition & 1 deletion scripts/js/commands/checkStaleImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 469fdf9

Please sign in to comment.