-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add last verified script #3154
base: main
Are you sure you want to change the base?
Add last verified script #3154
Conversation
svekars
commented
Nov 8, 2024
•
edited
Loading
edited
- Add a script that inserts Created On, Last Updated On, Verified On after the title in the tutorials
- The .json with the tutorials audit data that is used for last verified is stored in the "last-reviewed-data-json" branch and downloaded via a new Makefile command
- Modified the GH tutorilas-build workflow to fetch all log history.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3154
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 1 PendingAs of commit 137f995 with merge base 3ba3a46 (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Delete the JSON from the main branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of unrelated files in this PR (which feels like a good changes on its own)
Please do not put scripts in a top-level folder, create scripts
folder or use .jenkins
one (which imo can be renamed to scripts, as Jenkins is no longer used for tutorials CI
@@ -44,6 +44,8 @@ jobs: | |||
- name: Checkout Tutorials | |||
uses: actions/checkout@v3 | |||
with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be done in separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need this to get the git history so that the Created On data is added correctly
@@ -0,0 +1,12 @@ | |||
:orphan: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this unrelated to PR in question?
beginner_source/t5_tutorial.rst
Outdated
@@ -1,3 +1,5 @@ | |||
:orphan: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unrelated
@@ -1,3 +1,5 @@ | |||
:orphan: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unrelated
from bs4 import BeautifulSoup | ||
|
||
# Check if the build directory is provided as an argument in the Makefile | ||
if len(sys.argv) < 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow __main__
code pattern: https://docs.python.org/3/library/__main__.html
def get_creation_date(file_path): | ||
try: | ||
result = subprocess.run( | ||
["git", "log", "--diff-filter=A", "--format=%aD", "--", file_path], | ||
capture_output=True, | ||
text=True, | ||
check=True, | ||
) | ||
if result.stdout: | ||
creation_date = result.stdout.splitlines()[0] | ||
creation_date = datetime.strptime(creation_date, "%a, %d %b %Y %H:%M:%S %z") | ||
formatted_date = creation_date.strftime("%b %d, %Y") | ||
else: | ||
formatted_date = "Unknown" | ||
return formatted_date | ||
except subprocess.CalledProcessError: | ||
return "Unknown" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like get_last_updated
and get_created
could benefit from some refactoring of common code.
And why unknown
is an accepted answer? Shouldn't it raise an exception that should be handled elsewhere?