Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Adding newline at the end of a block so that it gets rendered #3

Merged
merged 12 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/changelog-ci-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ commit_changelog: false
comment_changelog: true
pull_request_title_regex: '^(Fix|Feature|Documentation|Improvement):.+$'
group_config:
- title: 'Bug Fixes'
- title: 'Fix'
labels:
- 'Fix'
- title: 'Features'
- title: 'Feature'
labels:
- 'Feature'
- title: 'Documentation'
labels:
- 'Documentation'
- title: 'Improvements'
- title: 'Improvement'
labels:
- 'Improvement'
version_regex: 'v?[0-9]+.[0-9]+.[0-9]+'
include_unlabeled: true
6 changes: 1 addition & 5 deletions .github/workflows/changelog-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@ name: Changelog CI

on:
pull_request:
types: [opened, reopened, synchronize]
types: [ opened, reopened, synchronize]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run Changelog CI
uses: saadmk11/changelog-ci@v1.1.2
with:
changelog_filename: CHANGELOG.md
config_file: .github/changelog-ci-config.yaml
output_file_name: 'changelog-ci-output.md'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 15 additions & 20 deletions .github/workflows/pr-title-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Install Nushell
uses: hustcer/setup-nu@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyGithub
version: 0.94.1
- name: Check PR Title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
import os
import re
from github import Github

title = os.environ['PR_TITLE']
regex = r'^(Fix|Feature|Documentation|Improvement):.+$'

if not re.match(regex, title):
print('PR title does not match the required format. It should start with one of: Fix:, Feature:, Documentation:, or Improvement:')
exit(1)
else:
print('PR title is correctly formatted.')
nu -c '
let title = $env.PR_TITLE
let titles = [Fix, Feature, Improvement, Documentation]
let type = $title | parse "{Type}:{Title}" | get Type.0 | str trim
if ($type in $titles) {
print "PR title is correctly formatted."
exit 0
} else {
print "PR title does not match the required format. It should start with one of: Fix:, Feature:, Documentation:, or Improvement:"
exit 1
}
'
53 changes: 53 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Update Changelog Version

on:
push:
branches:
- main

jobs:
update-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Update Changelog
run: |
import re
from datetime import datetime

# Read the current changelog
with open('CHANGELOG.md', 'r') as f:
changelog = f.read()

# Get the latest version from the changelog
version_match = re.search(r'## \[(\d+\.\d+\.\d+)\]', changelog)
if version_match:
latest_version = version_match.group(1)
major, minor, patch = map(int, latest_version.split('.'))
new_version = f"{major}.{minor}.{patch + 1}"
else:
new_version = "0.1.0"

# Add the new version to the changelog
today = datetime.now().strftime("%Y-%m-%d")
new_section = f"## [{new_version}] - {today}\n\n"
updated_changelog = re.sub(r'# Changelog\n', f'# Changelog\n\n{new_section}', changelog)

# Write the updated changelog
with open('CHANGELOG.md', 'w') as f:
f.write(updated_changelog)

shell: python
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add CHANGELOG.md
git commit -m "Update changelog with new version" || echo "No changes to commit"
git push
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ If you want to directly contribute to the code, look no further! Here is an expe
- Note: if you don't have clippy installed you can add it to your toolchain via `rustup component add clippy`
4. If you are adding a new feature, please update the README.md.
5. Commit and create a pull request to merge into the main branch. Please fill out the pull request template.
6. Make sure that your PR is prepended with either of these in its title, Fix: , Documentation: , Improvement: , Feature: .
6. Ask a maintainer to review your pull request.
7. Check if the CI workflow passes. These consist of clippy lints, rustfmt checks, and basic tests. If you are a first-time contributor, you may need to wait for a maintainer to let CI run.
8. If changes are suggested or any comments are made, they should probably be addressed.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions src/scrollable_textarea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ impl MarkdownCache {
return Ok(cached.clone());
}

let rendered =
self.renderer
.render_markdown(content.to_string(), title.to_string(), width)?;
let content = format!("{}\n", content);

let rendered = self
.renderer
.render_markdown(content, title.to_string(), width)?;

if self.cache.len() >= RENDER_CACHE_SIZE {
if let Some(old_key) = self.cache.keys().next().cloned() {
Expand Down
Loading