Skip to content

Commit a01aa21

Browse files
committed
fix dates
1 parent f6e4ac7 commit a01aa21

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

.github/scripts/generate_release_notes.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def categorize_commits(commits):
6262
sha = commit['sha']
6363
url = commit['html_url']
6464
entry = f"- {message.splitlines()[0]} [{sha[:7]}]({url})"
65-
# Simple categorization based on keywords
6665
msg_lower = message.lower()
6766
if "fix" in msg_lower:
6867
categories["Reliability"].append(entry)
@@ -78,21 +77,31 @@ def categorize_commits(commits):
7877

7978
def generate_release_notes(commits, categories):
8079
if commits:
81-
dates = [commit['commit']['author']['date'] for commit in commits]
82-
dates = sorted(dates)
83-
start_date = datetime.fromisoformat(dates[0].replace("Z", "+00:00")).strftime("%m/%d/%Y")
84-
end_date = datetime.fromisoformat(dates[-1].replace("Z", "+00:00")).strftime("%m/%d/%Y")
80+
# Use input dates if provided, else fallback to commit dates
81+
start_date = START_DATE_STR or datetime.fromisoformat(
82+
commits[0]['commit']['author']['date'].replace("Z", "+00:00")).strftime("%Y-%m-%d")
83+
end_date = END_DATE_STR or datetime.fromisoformat(
84+
commits[-1]['commit']['author']['date'].replace("Z", "+00:00")).strftime("%Y-%m-%d")
85+
# Format to mm/dd/yyyy for release notes
86+
start_date_fmt = datetime.fromisoformat(start_date).strftime("%m/%d/%Y")
87+
end_date_fmt = datetime.fromisoformat(end_date).strftime("%m/%d/%Y")
8588
else:
86-
start_date = END_DATE_STR or "N/A"
87-
end_date = END_DATE_STR or "N/A"
89+
start_date_fmt = START_DATE_STR or "N/A"
90+
end_date_fmt = END_DATE_STR or "N/A"
8891

8992
notes = []
9093
notes.append(f"{RELEASE_TAG} Release Notes")
9194
notes.append("")
92-
notes.append(f"We're excited to release React Native Windows {RELEASE_TAG} targeting React Native {RELEASE_TAG}! There have been many changes to both react-native-windows and react-native itself, and we would love your feedback on anything that doesn't work as expected. This release includes the commits to React Native Windows from {start_date} - {end_date}.")
95+
notes.append(
96+
f"We're excited to release React Native Windows {RELEASE_TAG} targeting React Native {RELEASE_TAG}! "
97+
f"There have been many changes to both react-native-windows and react-native itself, and we would love your "
98+
f"feedback on anything that doesn't work as expected. This release includes the commits to React Native Windows "
99+
f"from {start_date_fmt} - {end_date_fmt}."
100+
)
93101
notes.append("")
94102
notes.append("## How to upgrade")
95-
notes.append("You can view the changes made to the default new React Native Windows applications for C++ and C# using React Native Upgrade Helper. See this [document](https://microsoft.github.io/react-native-windows/docs/upgrade-app) for more details.")
103+
notes.append("You can view the changes made to the default new React Native Windows applications for C++ and C# "
104+
"using React Native Upgrade Helper. See this [document](https://microsoft.github.io/react-native-windows/docs/upgrade-app) for more details.")
96105
notes.append("")
97106
for category, entries in categories.items():
98107
if entries:

.github/workflows/generate-release-notes.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ jobs:
4949
env:
5050
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5151
RELEASE_TAG: ${{ steps.get_tag.outputs.tag }}
52-
START_DATE: ${{ github.event.inputs.start_date || '' }}
53-
END_DATE: ${{ github.event.inputs.end_date || '' }}
52+
START_DATE: ${{ github.event.inputs.start_date || '2023-01-27' }}
53+
END_DATE: ${{ github.event.inputs.end_date || '2023-05-12' }}
5454
run: |
5555
python .github/scripts/generate_release_notes.py > release_notes.md
5656
mkdir -p .github/release_notes

0 commit comments

Comments
 (0)