Skip to content

Commit 8cfa421

Browse files
Merge pull request #306 from pytorch-fdn/reginankenchor-patch-13
Add workflow to close ambassador applications for 2025
2 parents 1f08e27 + cfe899b commit 8cfa421

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Close Ambassador Applications 2025
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry_run:
7+
description: "Run in dry-run mode? (no issues will be closed)"
8+
required: false
9+
default: "true"
10+
11+
jobs:
12+
close-issues:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
issues: write
17+
18+
steps:
19+
- name: Close all open application issues
20+
uses: actions/github-script@v7
21+
with:
22+
script: |
23+
const { owner, repo } = context.repo;
24+
const dryRun = core.getInput("dry_run") === "true";
25+
const per_page = 100;
26+
let page = 1;
27+
28+
const commentBody = "Application cycle for the 2025 ambassador program is now closed.";
29+
30+
core.info(`Dry run mode: ${dryRun}`);
31+
32+
while (true) {
33+
const { data: issues } = await github.rest.issues.listForRepo({
34+
owner,
35+
repo,
36+
state: "open",
37+
per_page,
38+
page,
39+
});
40+
41+
if (issues.length === 0) {
42+
core.info("No more open issues found.");
43+
break;
44+
}
45+
46+
for (const issue of issues) {
47+
if (issue.pull_request) continue;
48+
49+
core.info(`Would close issue #${issue.number}: ${issue.title}`);
50+
51+
if (!dryRun) {
52+
await github.rest.issues.createComment({
53+
owner,
54+
repo,
55+
issue_number: issue.number,
56+
body: commentBody,
57+
});
58+
59+
await github.rest.issues.update({
60+
owner,
61+
repo,
62+
issue_number: issue.number,
63+
state: "closed",
64+
});
65+
}
66+
}
67+
68+
page += 1;
69+
}

0 commit comments

Comments
 (0)