Skip to content

Commit 677a90b

Browse files
authored
Rename workflow and update visibility input handling...
...in the Monthly Empty-Repo Report GitHub Action.
1 parent a88e890 commit 677a90b

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

.github/workflows/empty-repos.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: "Monthly Repo Health Report"
1+
name: "Monthly Empty-Repo Report"
22

33
on:
44
schedule:
5-
- cron: '0 0 1 * *'
5+
- cron: '0 0 1 * *' # Runs on the 1st of every month
66
workflow_dispatch:
77
inputs:
88
visibility:
@@ -20,7 +20,7 @@ permissions:
2020
issues: write
2121

2222
env:
23-
SCAN_ORG: github # ← your org here
23+
SCAN_ORG: github #update with your GitHub org if different
2424

2525
jobs:
2626
report:
@@ -32,31 +32,33 @@ jobs:
3232
with:
3333
github-token: ${{ secrets.GITHUB_TOKEN }}
3434
script: |
35-
const org = process.env.SCAN_ORG;
36-
const visibility = '${{ github.event.inputs.visibility }}';
35+
const org = process.env.SCAN_ORG;
36+
const visibility = '${{ github.event.inputs.visibility || 'all' }}';
3737
const repos = await github.paginate(
3838
github.rest.repos.listForOrg,
3939
{ org, per_page: 100 }
4040
);
4141
4242
const empty = [], readmeOnly = [];
4343
44-
for (const r of repos) {
45-
// skip by visibility
46-
if (visibility === 'public' && r.private) continue;
47-
if (visibility === 'private' && !r.private) continue;
44+
for (const r of repos) {
45+
// skip by visibility
46+
if (visibility === 'public' && r.private) continue;
47+
if (visibility === 'private' && !r.private) continue;
4848
49-
if (r.archived) continue; // 👈 skip archived repositories
49+
// skip archived repos
50+
if (r.archived) continue;
5051
51-
let contents;
52-
...
52+
let contents;
5353
try {
5454
const res = await github.rest.repos.getContent({
55-
owner: org, repo: r.name, path: ""
55+
owner: org,
56+
repo: r.name,
57+
path: ""
5658
});
5759
contents = Array.isArray(res.data) ? res.data : [res.data];
5860
} catch (e) {
59-
if (e.status === 409) contents = [];
61+
if (e.status === 409) contents = []; // empty repo
6062
else throw e;
6163
}
6264
@@ -81,13 +83,13 @@ for (const r of repos) {
8183
let body = `# Empty Repo Report for \`${org}\` (${today})\n\n`;
8284
body += `**Visibility:** ${visibility}\n\n`;
8385
body += "| Repository | Status |\n| --- | --- |\n";
84-
for (const u of empty) body += `| ${u} | empty |\n`;
86+
for (const u of empty) body += `| ${u} | empty |\n`;
8587
for (const u of readmeOnly) body += `| ${u} | README-only |\n`;
8688
body += "\n_Automatically generated on the 1st of each month._";
8789
8890
await github.rest.issues.create({
8991
owner: context.repo.owner,
90-
repo: context.repo.repo,
92+
repo: context.repo.repo,
9193
title: `Monthly Repo Health: ${org} (${today})`,
9294
body
9395
});

0 commit comments

Comments
 (0)
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