Skip to content

Update empty-repos.yml #6

Update empty-repos.yml

Update empty-repos.yml #6

Workflow file for this run

name: "Monthly Repo Health Report"
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
inputs:
visibility:
description: 'Which repos to scan: all, public, or private'
required: true
default: 'all'
type: choice
options:
- all
- public
- private
permissions:
contents: read
issues: write
env:
SCAN_ORG: github # ← your org here
jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Generate empty/README-only report 🕵️
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const org = process.env.SCAN_ORG;
const visibility = '${{ github.event.inputs.visibility }}';
const repos = await github.paginate(
github.rest.repos.listForOrg,
{ org, per_page: 100 }
);
const empty = [], readmeOnly = [];
for (const r of repos) {

Check failure on line 44 in .github/workflows/empty-repos.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/empty-repos.yml

Invalid workflow file

You have an error in your yaml syntax on line 44
// skip by visibility
if (visibility === 'public' && r.private) continue;
if (visibility === 'private' && !r.private) continue;
if (r.archived) continue; // 👈 skip archived repositories
let contents;
...
try {
const res = await github.rest.repos.getContent({
owner: org, repo: r.name, path: ""
});
contents = Array.isArray(res.data) ? res.data : [res.data];
} catch (e) {
if (e.status === 409) contents = [];
else throw e;
}
if (contents.length === 0) {
empty.push(r.full_name);
} else {
const nonReadmes = contents.filter(f =>
!/^README(\.[a-z]+)?$/i.test(f.name)
);
if (nonReadmes.length === 0) {
readmeOnly.push(r.full_name);
}
}
}
if (empty.length + readmeOnly.length === 0) {
console.log("✔ No matching repos found. Skipping issue.");
return;
}
const today = new Date().toISOString().slice(0,10);
let body = `# Empty Repo Report for \`${org}\` (${today})\n\n`;
body += `**Visibility:** ${visibility}\n\n`;
body += "| Repository | Status |\n| --- | --- |\n";
for (const u of empty) body += `| ${u} | empty |\n`;
for (const u of readmeOnly) body += `| ${u} | README-only |\n`;
body += "\n_Automatically generated on the 1st of each month._";
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Monthly Repo Health: ${org} (${today})`,
body
});
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy