-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from brown9804/brown9804-patch-1
cleaning
- Loading branch information
Showing
4 changed files
with
174 additions
and
0 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,42 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# This workflow will install Deno then run `deno lint` and `deno test`. | ||
# For more information see: https://github.com/denoland/setup-deno | ||
|
||
name: Deno | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Setup repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Deno | ||
# uses: denoland/setup-deno@v1 | ||
uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2 | ||
with: | ||
deno-version: v1.x | ||
|
||
# Uncomment this step to verify the use of 'deno fmt' on each commit. | ||
# - name: Verify formatting | ||
# run: deno fmt --check | ||
|
||
- name: Run linter | ||
run: deno lint | ||
|
||
- name: Run tests | ||
run: deno test -A |
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,42 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: './src/' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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,41 @@ | ||
name: Update Last Modified Date | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
update-date: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: pip install python-dateutil | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
- name: Update last modified date in Markdown files | ||
run: python .github/workflows/update_date.py | ||
|
||
- name: Commit changes | ||
run: | | ||
git add -A | ||
git commit -m "Update last modified date in Markdown files" || echo "No changes to commit" | ||
git push origin HEAD:${{ github.event.pull_request.head.ref }} |
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,49 @@ | ||
import os | ||
import subprocess | ||
from datetime import datetime, timezone | ||
|
||
# Get the list of modified files | ||
result = subprocess.run(['git', 'diff', '--name-only', 'HEAD~1'], stdout=subprocess.PIPE) | ||
modified_files = result.stdout.decode('utf-8').split() | ||
|
||
# Debugging: Print the list of modified files | ||
print("Modified files:", modified_files) | ||
|
||
# Filter for Markdown files | ||
modified_md_files = [f for f in modified_files if f.endswith('.md')] | ||
|
||
# Debugging: Print the list of modified Markdown files | ||
print("Modified Markdown files:", modified_md_files) | ||
|
||
# Current date | ||
current_date = datetime.now(timezone.utc).strftime('%Y-%m-%d') | ||
|
||
# Function to update the last modified date in a file | ||
def update_date_in_file(file_path): | ||
with open(file_path, 'r') as file: | ||
lines = file.readlines() | ||
|
||
updated = False | ||
with open(file_path, 'w') as file: | ||
for line in lines: | ||
if line.startswith('Last updated:'): | ||
file.write(f'Last updated: {current_date}\n') | ||
updated = True | ||
else: | ||
file.write(line) | ||
if not updated: | ||
file.write(f'\nLast updated: {current_date}\n') | ||
|
||
# Check if there are any modified Markdown files | ||
if not modified_md_files: | ||
print("No modified Markdown files found.") | ||
exit(0) | ||
|
||
# Update the date in each modified Markdown file | ||
for file_path in modified_md_files: | ||
print(f"Updating file: {file_path}") # Debugging: Print the file being updated | ||
update_date_in_file(file_path) | ||
|
||
# Add and commit changes | ||
subprocess.run(['git', 'add', '-A']) | ||
subprocess.run(['git', 'commit', '-m', 'Update last modified date in Markdown files']) |