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
Hide 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.
...
@@ -18,6 +18,7 @@ https://github.com/allenai/allennlp.
from
datetime
import
datetime
as
dt
from
datetime
import
datetime
as
dt
import
os
import
os
import
github.GithubException
from
github
import
Github
from
github
import
Github
...
@@ -36,8 +37,8 @@ def main():
...
@@ -36,8 +37,8 @@ def main():
repo
=
g
.
get_repo
(
"huggingface/transformers"
)
repo
=
g
.
get_repo
(
"huggingface/transformers"
)
open_issues
=
repo
.
get_issues
(
state
=
"open"
)
open_issues
=
repo
.
get_issues
(
state
=
"open"
)
for
issue
in
open_issues
:
for
i
,
issue
in
enumerate
(
open_issues
)
:
print
(
issue
)
print
(
i
,
issue
)
comments
=
sorted
([
comment
for
comment
in
issue
.
get_comments
()],
key
=
lambda
i
:
i
.
created_at
,
reverse
=
True
)
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
last_comment
=
comments
[
0
]
if
len
(
comments
)
>
0
else
None
if
(
if
(
...
@@ -47,20 +48,26 @@ def main():
...
@@ -47,20 +48,26 @@ def main():
and
not
any
(
label
.
name
.
lower
()
in
LABELS_TO_EXEMPT
for
label
in
issue
.
get_labels
())
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.")
# print(f"Would close issue {issue.number} since it has been 7 days of inactivity since bot mention.")
issue
.
edit
(
state
=
"closed"
)
try
:
issue
.
edit
(
state
=
"closed"
)
except
github
.
GithubException
as
e
:
print
(
"Couldn't close the issue:"
,
repr
(
e
))
elif
(
elif
(
(
dt
.
utcnow
()
-
issue
.
updated_at
.
replace
(
tzinfo
=
None
)).
days
>
23
(
dt
.
utcnow
()
-
issue
.
updated_at
.
replace
(
tzinfo
=
None
)).
days
>
23
and
(
dt
.
utcnow
()
-
issue
.
created_at
.
replace
(
tzinfo
=
None
)).
days
>=
30
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
())
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}")
# print(f"Would add stale comment to {issue.number}")
issue
.
create_comment
(
try
:
"This issue has been automatically marked as stale because it has not had "
issue
.
create_comment
(
"recent activity. If you think this still needs to be addressed "
"This issue has been automatically marked as stale because it has not had "
"please comment on this thread.
\n\n
Please note that issues that do not follow the "
"recent activity. If you think this still needs to be addressed "
"[contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) "
"please comment on this thread.
\n\n
Please note that issues that do not follow the "
"are likely to be ignored."
"[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__"
:
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