forked from MarlinFirmware/Marlin
-
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
40923d7
commit 8cb4e91
Showing
5 changed files
with
113 additions
and
38 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,50 @@ | ||
name: Generate HTML from Recent Commits | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 12 1 * *' # Run 1st day of the month every 30 days | ||
|
||
jobs: | ||
generate_html: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Checkout Wiki | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: classicrocker883/Marlin.wiki | ||
path: wiki | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
sparse-checkout: | | ||
"What's-New-in-this-Release.md" | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | ||
pip install requests && pip install emoji | ||
|
||
- name: Generate Commits and merge with HTML | ||
run: | | ||
python buildroot/share/scripts/generate_html.py | ||
while [ ! -f buildroot/share/scripts/output_HTML_commits.txt ]; do | ||
sleep 1 | ||
done | ||
python buildroot/share/scripts/commit_to_wiki.py | ||
- name: Commit and Push Changes | ||
run: | | ||
git config user.name "Andrew" | ||
git config user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com" | ||
git remote add wiki https://github.com/classicrocker883/Marlin.wiki.git | ||
git add "wiki/What's-New-in-this-Release.md" | ||
git commit -m "⛙ Merge new commits into wiki" | ||
git push wiki master |
This file was deleted.
Oops, something went wrong.
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,58 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
|
||
# Define the path to output_HTML_commits.txt within the workspace directory | ||
output_commits_path = os.path.join(os.getenv('GITHUB_WORKSPACE'), 'buildroot', 'share', 'scripts', 'output_HTML_commits.txt') | ||
|
||
# Check if output_HTML_commits.txt exists | ||
if not os.path.exists(output_commits_path): | ||
print(f"Error: output_HTML_commits.txt not found at {output_commits_path}") | ||
print("Falling back to default path...") | ||
output_commits_path = 'buildroot/share/scripts/output_HTML_commits.txt' | ||
|
||
if not os.path.exists(output_commits_path): | ||
print(f"Error: output_HTML_commits.txt not found at buildroot/share/scripts") | ||
exit(1) | ||
|
||
# Read the contents of output_HTML_commits.txt | ||
with open(output_commits_path, 'r') as file1: | ||
file1_content = file1.readlines() | ||
|
||
# Define the path to What's-New-in-this-Release.md within the workspace directory | ||
release_notes_path = os.path.join(os.getenv('GITHUB_WORKSPACE'), "wiki", "What's-New-in-this-Release.md") | ||
|
||
# Check if What's-New-in-this-Release.md exists | ||
if not os.path.exists(release_notes_path): | ||
print(f"Error: What's-New-in-this-Release.md not found at {release_notes_path}") | ||
print("Falling back to default path...") | ||
release_notes_path = "wiki/What's-New-in-this-Release.md" | ||
|
||
if not os.path.exists(release_notes_path): | ||
print(f"Error: What's-New-in-this-Release.md not found at wiki") | ||
exit(1) | ||
# with open("https://raw.githubusercontent.com/wiki/classicrocker883/MRiscoCProUI/What's-New-in-this-Release.md", 'r') as file2: | ||
# file2_content = file2.readlines() | ||
|
||
# Read the content of What's-New-in-this-Release.md | ||
with open(release_notes_path, 'r') as file2: | ||
file2_content = file2.readlines() | ||
|
||
# Find the position of <ul> in What's-New-in-this-Release.md | ||
ul_index = next((i for i, line in enumerate(file2_content) if '<ul>' in line), None) | ||
|
||
# Extract existing commits from What's-New-in-this-Release.md | ||
existing_commits = [line.strip() for line in file2_content if '<li>' in line] | ||
|
||
# Merge the contents of output_HTML_commits.txt with What's-New-in-this-Release.md, omitting duplicates | ||
new_commits = [line for line in file1_content if '<li>' in line and line.strip() not in existing_commits] | ||
|
||
# Insert the new content after <ul> in the correct order and without duplicates | ||
if ul_index is not None: | ||
merged_content = file2_content[:ul_index + 1] + new_commits + file2_content[ul_index + 1:] | ||
else: | ||
merged_content = file2_content + new_commits # If <ul> is not found, append at the end | ||
|
||
# Write the merged content back to What's-New-in-this-Release.md | ||
with open(release_notes_path, 'w') as file2: | ||
file2.writelines(merged_content) |
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
Empty file.