-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e6284d
commit 0fecf1b
Showing
6 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: fetch-commit-dates | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '_data/commit_dates.json' | ||
|
||
jobs: | ||
|
||
fetch-commit-dates: | ||
if: ${{ !startsWith(github.event.head_commit.committer.name, 'GitHub Actions') }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Required to get full commit history | ||
|
||
- name: Run Ruby script | ||
run: ruby fetch-commit-dates.rb | ||
|
||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
commit-message: "Update file dates" | ||
title: "[auto] Update file dates" | ||
body: "Automated action to update modified file dates to the latest commit date." | ||
branch: "actions/update-file-dates" | ||
base: main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'json' | ||
require 'fileutils' | ||
|
||
# Create _data folder if it doesn't exist | ||
data_folder = '_data' | ||
Dir.mkdir(data_folder) unless File.exists?(data_folder) | ||
|
||
last_commits = {} | ||
`git ls-files -- '*.md'`.each_line do |file| | ||
file.chomp! | ||
commit_date = `git log -1 --format='%ad' --date=iso -- "#{file}"`.chomp | ||
last_commits[file] = commit_date | ||
end | ||
|
||
File.write(File.join(data_folder, 'commit_dates.json'), JSON.pretty_generate(last_commits)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters