Skip to content

Commit 0c73dce

Browse files
authored
Updated title, includes approved PRs
1) Changes title from "Add Unanswered PRs and Issues to PyTorch Org Project 136" to "Add Open External Contributor PRs and Issues to PyTorch Org Project 136" 2) Changed constraint to add PRs from adding approved PRs as well
1 parent c58e175 commit 0c73dce

File tree

1 file changed

+32
-15
lines changed

1 file changed

+32
-15
lines changed

.github/workflows/add-unanswered-to-project.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
name: Add Unanswered PRs and Issues to PyTorch Org Project 136
1+
name: Add Open External Contributor PRs and Issues to PyTorch Org Project 136
22

33
on:
44
schedule:
5-
- cron: '0 * * * *' # every hour, on the hour (UTC)
6-
workflow_dispatch: # allows manual runs too
5+
- cron: '0 * * * *'
6+
workflow_dispatch:
77

88
jobs:
99
add_to_project:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Query open PRs and issues and add to org project
12+
- name: Add open issues and open, non-draft PRs to org project (excluding certain authors)
1313
uses: actions/github-script@v7
1414
with:
1515
github-token: ${{ secrets.PYTORCH_PROJECT_PAT }}
@@ -18,6 +18,24 @@ jobs:
1818
const owner = 'pytorch';
1919
const repo = 'executorch';
2020
21+
// List of authors to exclude
22+
const excludedAuthors = new Set([
23+
"nil-is-all", "cbilgin", "KimishPatel", "psiddh", "digantdesai", "SS-JIA", "ahmtox", "mcr229", "shoumikhin",
24+
"manuelcandales", "metascroy", "cccclai", "rohansjoshi", "kirklandsign", "abhinaykukkadapu", "JacobSzwejbka",
25+
"Conarnar", "lucylq", "larryliu0820", "BujSet", "Gasoonjia", "Juntian777", "guangy10", "jackzhxng",
26+
"GregoryComer", "leafs1", "swolchok", "mergennachin", "tarun292", "byjlw", "jathu", "Jack-Khuu", "georgehong",
27+
"zhenyan-zhang-meta", "silverguo", "dbort", "jorgep31415", "huydhn", "mcremon-meta", "trivedivivek", "angelayi",
28+
"helunwencser", "hsharma35", "zhxchen17", "iseeyuan", "svekars", "nathanaelsee", "dulinriley", "jerryzh168",
29+
"cmodi-meta", "bigfootjon", "sxu", "ydwu4", "Riandy", "tugsbayasgalan", "bsoyluoglu", "yangw-dev", "YIWENX14",
30+
"namanahuja", "yushangdi", "limintang", "pianpwk", "viveknayakatmeta", "andreanicastro", "JakeStevens",
31+
"gmagogsfm", "zonglinpeng", "eigen-k", "derekxu", "salilsdesai", "skrtskrtfb", "pssrawat", "r-barnes", "pytorchbot",
32+
"pytorchmergebot", "pytorchupdatebot", "facebook-github-bot", "Erik-Lundell", "zingo", "AdrianLundell",
33+
"oscarandersson8218", "per", "Sebastian-Larsson", "SaoirseARM", "robell", "mansnils", "martinlsm", "freddan80",
34+
"YufengShi-dudu", "tom-arm", "perheld", "Jerry-Ge", "gggekov", "fumchin", "wwwind", "haowhsu-quic", "shewu-quic",
35+
"winskuo-quic", "chunit-quic", "DannyYuyang-quic", "chuntl", "cymbalrush", "DenisVieriu97", "billmguo",
36+
"StrycekSimon", "jirioc", "robert-kalmar", "skywall", "neuropilot-captain"
37+
]);
38+
2139
async function addItem(contentId, type, number) {
2240
try {
2341
await github.graphql(`
@@ -29,12 +47,17 @@ jobs:
2947
`);
3048
console.log(`Added ${type} #${number} to project`);
3149
} catch (error) {
32-
console.log(`Error adding ${type} #${number}: ${error.message}`);
50+
if (error.message && error.message.includes("A project item already exists for this content")) {
51+
// Ignore if already exists
52+
console.log(`${type} #${number} already in project`);
53+
} else {
54+
console.log(`Error adding ${type} #${number}: ${error.message}`);
55+
}
3356
}
3457
}
3558
3659
try {
37-
// Add open issues (not PRs)
60+
// Add open issues (not PRs) and exclude by author
3861
const issues = await github.paginate(
3962
github.rest.issues.listForRepo,
4063
{
@@ -45,12 +68,12 @@ jobs:
4568
}
4669
);
4770
for (const issue of issues) {
48-
if (!issue.pull_request) {
71+
if (!issue.pull_request && !excludedAuthors.has(issue.user.login)) {
4972
await addItem(issue.node_id, 'issue', issue.number);
5073
}
5174
}
5275
53-
// Add open, non-draft PRs with NO approved reviews
76+
// Add open, non-draft PRs (regardless of review state), exclude by author
5477
const prs = await github.paginate(
5578
github.rest.pulls.list,
5679
{
@@ -61,13 +84,7 @@ jobs:
6184
}
6285
);
6386
for (const pr of prs) {
64-
const reviews = await github.rest.pulls.listReviews({
65-
owner,
66-
repo,
67-
pull_number: pr.number
68-
});
69-
const approved = reviews.data.some(r => r.state === 'APPROVED');
70-
if (!approved) {
87+
if (!excludedAuthors.has(pr.user.login)) {
7188
await addItem(pr.node_id, 'pr', pr.number);
7289
}
7390
}

0 commit comments

Comments
 (0)