-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix modified dates in docs #2478
Conversation
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.
Thanks @philyoosays! Here a couple of suggestions. Apart from that I'm just worried about the time that it takes to retrieve all data for all files (which can be hundreds). Let's discuss on Slack.
src/scripts/git_data.py
Outdated
|
||
if GITHUB_TOKEN is None: | ||
print('Github token not found') | ||
return get_last_commit_date_by_terminal_log(file_path) |
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.
we can get rid of that function and return None or "N/A" here.
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.
.github/workflows/build-website.yml
Outdated
@@ -21,7 +21,9 @@ jobs: | |||
|
|||
- run: ./src/scripts/structure_mastg.sh | |||
|
|||
- run: python3 src/scripts/transform_files.py | |||
- env: |
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 might work without this. The GITHUB_TOKEN is created automatically on each run and should be accessible to the script via env.
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.
Let's try. We can always revert the commit that removes this declaration
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.
Co-authored-by: Carlos Holguera <[email protected]>
…wasp-mastg into fix-modified-dates-in-docs
Co-authored-by: Carlos Holguera <[email protected]>
…wasp-mastg into fix-modified-dates-in-docs
Co-authored-by: Carlos Holguera <[email protected]>
Co-authored-by: Carlos Holguera <[email protected]>
…wasp-mastg into fix-modified-dates-in-docs
Co-authored-by: Carlos Holguera <[email protected]>
…wasp-mastg into fix-modified-dates-in-docs
Fixed with depth=0 in #2564 |
Description
This PR adds a fetch to the Github REST API to collect the last modified date for commits to MASTG markdown files for display in the MASTG mkdocs site.
As a fallback in case the
GITHUB_TOKEN
was not able to be retrieved from the Github Actions pipeline, the original code to get last modified dates was preserved and called.Issue
The issue being fixed has to do with the last modified dates being incorrect in the published mkdocs site. It seems that the Github Actions pipeline is copying the files and the original code that determines the last modified dates is using the local terminal
git log
method to determine last modified date. This is causing all the files to have the same last modified date (date of merge to master for any file) that does not match the actual last modified dates for the files in the repository.The Fix
To be sure that we have an accurate commit history, this fix uses the Github REST API to fetch the commit history for each markdown file from the repository.
Note To Maintainers: Please make sure that the
GITHUB_TOKEN
has read access to content.Thank you for submitting a Pull Request to the OWASP MASTG. Please make sure that:
If your PR is related to an issue. Please end your PR test with the following line:
This PR closes #< insert number here >.