Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
6ecb2ab6
Unverified
Commit
6ecb2ab6
authored
Oct 11, 2023
by
Lysandre Debut
Committed by
GitHub
Oct 11, 2023
Browse files
Fix stale bot for locked issues (#26711)
parent
69873d52
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
scripts/stale.py
scripts/stale.py
+17
-10
No files found.
scripts/stale.py
View file @
6ecb2ab6
...
...
@@ -18,6 +18,7 @@ https://github.com/allenai/allennlp.
from
datetime
import
datetime
as
dt
import
os
import
github.GithubException
from
github
import
Github
...
...
@@ -36,8 +37,8 @@ def main():
repo
=
g
.
get_repo
(
"huggingface/transformers"
)
open_issues
=
repo
.
get_issues
(
state
=
"open"
)
for
issue
in
open_issues
:
print
(
issue
)
for
i
,
issue
in
enumerate
(
open_issues
)
:
print
(
i
,
issue
)
comments
=
sorted
([
comment
for
comment
in
issue
.
get_comments
()],
key
=
lambda
i
:
i
.
created_at
,
reverse
=
True
)
last_comment
=
comments
[
0
]
if
len
(
comments
)
>
0
else
None
if
(
...
...
@@ -47,13 +48,17 @@ def main():
and
not
any
(
label
.
name
.
lower
()
in
LABELS_TO_EXEMPT
for
label
in
issue
.
get_labels
())
):
# print(f"Would close issue {issue.number} since it has been 7 days of inactivity since bot mention.")
try
:
issue
.
edit
(
state
=
"closed"
)
except
github
.
GithubException
as
e
:
print
(
"Couldn't close the issue:"
,
repr
(
e
))
elif
(
(
dt
.
utcnow
()
-
issue
.
updated_at
.
replace
(
tzinfo
=
None
)).
days
>
23
and
(
dt
.
utcnow
()
-
issue
.
created_at
.
replace
(
tzinfo
=
None
)).
days
>=
30
and
not
any
(
label
.
name
.
lower
()
in
LABELS_TO_EXEMPT
for
label
in
issue
.
get_labels
())
):
# print(f"Would add stale comment to {issue.number}")
try
:
issue
.
create_comment
(
"This issue has been automatically marked as stale because it has not had "
"recent activity. If you think this still needs to be addressed "
...
...
@@ -61,6 +66,8 @@ def main():
"[contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) "
"are likely to be ignored."
)
except
github
.
GithubException
as
e
:
print
(
"Couldn't create comment:"
,
repr
(
e
))
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment