mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
Fix crash when org check is empty, run once weekly (#58281)
This commit is contained in:
4
.github/workflows/ghostbuster.yml
vendored
4
.github/workflows/ghostbuster.yml
vendored
@@ -2,8 +2,8 @@ name: Remove contributors with deleted accounts
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# https://crontab.guru/#0_0_*_*_*
|
||||
- cron: "0 0 * * *"
|
||||
# https://crontab.guru/#0_0_*_*_1
|
||||
- cron: "0 0 * * 1"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skipPR:
|
||||
|
||||
@@ -103,11 +103,17 @@ async function fetchGhosts(users) {
|
||||
}
|
||||
|
||||
// Filter out organizations
|
||||
const query = `query {
|
||||
${ghosts.map((user, i) => `o${i}: organization(login: "${user}") { id }`).join("\n")}
|
||||
}`;
|
||||
const result = await tryGQL(() => octokit.graphql(query));
|
||||
return new Set(ghosts.filter(g => result.data[`o${ghosts.indexOf(g)}`] === null));
|
||||
if (ghosts.length) {
|
||||
const query = `query {
|
||||
${ghosts.map((user, i) => `o${i}: organization(login: "${user}") { id }`).join("\n")}
|
||||
}`;
|
||||
const result = await tryGQL(() => octokit.graphql(query));
|
||||
if (result.data) {
|
||||
return new Set(ghosts.filter(g => result.data[`o${ghosts.indexOf(g)}`] === null));
|
||||
}
|
||||
}
|
||||
|
||||
return new Set(ghosts);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user