Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Community Documentation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
grp-bio-it
Community Documentation
Commits
f3728f8c
Verified
Commit
f3728f8c
authored
Jul 14, 2020
by
Toby Hodges
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use last_modified_date page variable
parent
5637d690
Pipeline
#16496
passed with stages
in 1 minute and 45 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
add_timestamp.py
add_timestamp.py
+2
-2
No files found.
add_timestamp.py
View file @
f3728f8c
...
...
@@ -16,7 +16,7 @@ import subprocess
def
get_last_modified_date
(
markdown_file
):
'''Extract the date of the most recent commit
that included changes to markdown_file.'''
git_log_cmd
=
"git log --pretty='format:%ai' {} |
cut -d' ' -f1 |
head -1"
git_log_cmd
=
"git log --pretty='format:%ai' {} | head -1"
date_string
=
subprocess
.
check_output
(
git_log_cmd
.
format
(
markdown_file
),
shell
=
True
).
strip
()
return
date_string
...
...
@@ -26,7 +26,7 @@ for filename in argv[1:]:
lines
=
infh
.
readlines
()
assert
lines
[
0
].
startswith
(
'---'
),
"Error: {} doesn't appear to be a valid Markdown file with a YAML header. Please check you filenames and try again."
.
format
(
filename
)
last_modified
=
get_last_modified_date
(
filename
)
lines
.
insert
(
1
,
"modified_date: '{}'
\n
"
.
format
(
last_modified
))
lines
.
insert
(
1
,
"
last_
modified_date: '{}'
\n
"
.
format
(
last_modified
))
with
open
(
'{}.modified'
.
format
(
filename
),
'w'
)
as
outfh
:
for
line
in
lines
:
outfh
.
write
(
line
)
...
...
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