FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
fastapi/scripts/add_latest_release_date.py at master · fastapi/fastapi · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
fastapi
/
fastapi
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
9.8k
Star
102k
Code
Issues
1
Pull requests
78
Discussions
Actions
Projects
Security and quality
1
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
fastapi
/
scripts
/
add_latest_release_date.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (28 loc) · 1023 Bytes
Breadcrumbs
fastapi
/
scripts
/
add_latest_release_date.py
Copy path
File metadata and controls
40 lines (28 loc) · 1023 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Check release-notes.md and add today's date to the latest release header if missing."""
import
re
import
sys
from
datetime
import
date
RELEASE_NOTES_FILE
=
"docs/en/docs/release-notes.md"
RELEASE_HEADER_PATTERN
=
re
.
compile
(
r"^## (\d+\.\d+\.\d+)\s*(\(.*\))?\s*$"
)
def
main
()
->
None
:
with
open
(
RELEASE_NOTES_FILE
)
as
f
:
lines
=
f
.
readlines
()
for
i
,
line
in
enumerate
(
lines
):
match
=
RELEASE_HEADER_PATTERN
.
match
(
line
)
if
not
match
:
continue
version
=
match
.
group
(
1
)
date_part
=
match
.
group
(
2
)
if
date_part
:
print
(
f"Latest release
{
version
}
already has a date:
{
date_part
}
"
)
sys
.
exit
(
0
)
today
=
date
.
today
().
isoformat
()
lines
[
i
]
=
f"##
{
version
}
(
{
today
}
)
\n
"
print
(
f"Added date:
{
version
}
(
{
today
}
)"
)
with
open
(
RELEASE_NOTES_FILE
,
"w"
)
as
f
:
f
.
writelines
(
lines
)
sys
.
exit
(
0
)
print
(
"No release header found"
)
sys
.
exit
(
1
)
if
__name__
==
"__main__"
:
main
()
Back
|
FazBrowse Home
|
New Git URL