mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-07-16 17:15:18 +00:00
chore: update github workflow (#17058)
* perf: using markdownify instead of html2text * perf: remove html2text * chore: update github workflow * perf: Update Dockerfile with new base image tag --------- Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
32
.github/workflows/build-base-image.yml
vendored
32
.github/workflows/build-base-image.yml
vendored
@@ -27,6 +27,9 @@ on:
|
||||
type: string
|
||||
default: 'main'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -39,10 +42,20 @@ jobs:
|
||||
-d '{"state":"pending", "description":"Action running, merge disabled", "context":"Lock PR"}' \
|
||||
"https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
||||
|
||||
- name: Checkout repository
|
||||
- name: Checkout repository (PR branch)
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout repository (manual)
|
||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.branch }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
@@ -79,14 +92,27 @@ jobs:
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
echo "No changes to commit."
|
||||
exit 0
|
||||
fi
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git add Dockerfile
|
||||
git commit -m "perf: Update Dockerfile with new base image tag"
|
||||
git push
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
git push origin HEAD:${{ github.event.pull_request.head.ref }}
|
||||
else
|
||||
git push origin HEAD:${{ inputs.branch }}
|
||||
fi
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.fork == false }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Skip push for fork PR
|
||||
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }}
|
||||
run: echo "Pull request is from a fork, skipping commit and push."
|
||||
|
||||
- name: Unlock Pull Request
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM jumpserver/core-base:20260526_063354 AS stage-build
|
||||
FROM jumpserver/core-base:20260716_084505 AS stage-build
|
||||
|
||||
ARG VERSION
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from collections import OrderedDict
|
||||
from functools import wraps, cached_property
|
||||
from itertools import chain
|
||||
|
||||
import html2text
|
||||
from markdownify import markdownify
|
||||
import psutil
|
||||
from django.conf import settings
|
||||
from django.templatetags.static import static
|
||||
@@ -471,11 +471,7 @@ def is_macos():
|
||||
|
||||
|
||||
def convert_html_to_markdown(html_str):
|
||||
h = html2text.HTML2Text()
|
||||
h.body_width = 0
|
||||
h.ignore_links = False
|
||||
|
||||
markdown = h.handle(html_str)
|
||||
markdown = markdownify(html_str)
|
||||
markdown = markdown.replace('\n\n', '\n')
|
||||
markdown = markdown.replace('\n ', '\n')
|
||||
return markdown
|
||||
|
||||
@@ -4,9 +4,8 @@ from itertools import chain
|
||||
|
||||
from celery import shared_task
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from html2text import HTML2Text
|
||||
|
||||
from common.utils import lazyproperty
|
||||
from common.utils import lazyproperty, convert_html_to_markdown
|
||||
from common.utils.timezone import local_now
|
||||
from notifications.backends import BACKEND
|
||||
from settings.utils import get_login_title
|
||||
@@ -157,12 +156,9 @@ class Message(CustomMsgTemplateBase, metaclass=MessageType):
|
||||
return self.html_to_markdown(self.get_html_msg())
|
||||
|
||||
def get_text_msg(self) -> dict:
|
||||
h = HTML2Text()
|
||||
h.body_width = 90
|
||||
msg = self.get_html_msg()
|
||||
content = msg['message']
|
||||
h.ignore_links = self.text_msg_ignore_links
|
||||
msg['message'] = h.handle(content)
|
||||
msg['message'] = convert_html_to_markdown(content)
|
||||
return msg
|
||||
|
||||
@lazyproperty
|
||||
|
||||
@@ -59,7 +59,6 @@ dependencies = [
|
||||
'data-tree==0.0.1',
|
||||
'pyvmomi==8.0.1.0.2',
|
||||
'termcolor==2.3.0',
|
||||
'html2text==2020.1.16',
|
||||
'pyzipper==0.3.6',
|
||||
'python3-saml==1.16.0',
|
||||
'websocket-client==1.6.1',
|
||||
@@ -153,6 +152,7 @@ dependencies = [
|
||||
"telnetlib3==4.0.2",
|
||||
"defusedxml>=0.7.1",
|
||||
"ansible-builder>=3.1.1",
|
||||
"markdownify>=1.2.3",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
||||
Reference in New Issue
Block a user