Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-03-29 09:12:20 +08:00
commit 2fd66080cb
4 changed files with 34 additions and 9 deletions

View File

@ -25,13 +25,22 @@ jobs:
with:
python-version: "3.10"
- run: pip install PyGithub
- id: thislatestR
uses: pozetroninc/github-action-get-latest-release@master
with:
# owner: siyuan-note
# repo: siyuan
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
excludes: prerelease, draft
- name: Gather Release Information
id: release_info
run: |
echo "release_title=$(git show --format=%s --no-patch | head -1)" >> $GITHUB_OUTPUT
echo "release_version=$(TZ=Asia/Shanghai date +'v%Y%m%d%H%M')" >> $GITHUB_OUTPUT
changelog=$(python scripts/parse-changelog.py -t ${{ github.ref }} siyuan-note/siyuan)
changelog=$(python scripts/parse-changelog.py -t ${{ github.ref }} -b ${{ steps.thislatestR.outputs.release }} siyuan-note/siyuan)
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "release_body<<$EOF" >> $GITHUB_ENV
echo "$changelog" >> $GITHUB_ENV
@ -143,7 +152,7 @@ jobs:
working-directory: ${{ github.workspace }}/go/src/github.com/siyuan-note/siyuan/app
- name: Install Node Dependencies
run: pnpm install
run: pnpm install --no-frozen-lockfile
working-directory: ${{ github.workspace }}/go/src/github.com/siyuan-note/siyuan/app
- name: Building UI

View File

@ -954,7 +954,12 @@ powerMonitor.on("resume", async () => {
const result = await fetch("https://icanhazip.com", {timeout: 1000});
return 200 === result.status;
} catch (e) {
return false;
try {
const result = await fetch("https://api.ipify.org", {timeout: 1000});
return 200 === result.status;
} catch (e) {
return false;
}
}
}
};

View File

@ -313,8 +313,6 @@ func existAvailabilityStatus(workspaceAbsPath string) bool {
return false
}
logging.LogInfof("check workspace [%s] availability status", checkAbsPath)
runtime.LockOSThread()
defer runtime.LockOSThread()
if err := ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED); nil != err {

View File

@ -16,7 +16,7 @@ docmap = {
}
def generate_msg_from_repo(repo_name, tag_name):
def generate_msg_from_repo(repo_name, tag_name, lastestRelease):
"""Generate changelog messages from repository and tag name.
Envs:
@ -33,7 +33,7 @@ def generate_msg_from_repo(repo_name, tag_name):
gh = github.Github(token, base_url=f"https://{hostname}")
repo = gh.get_repo(repo_name)
milestone = find_milestone(repo, tag_name)
milestone = find_milestone(repo, tag_name, lastestRelease)
for issue in repo.get_issues(state="closed", milestone=milestone):
# REF https://pygithub.readthedocs.io/en/latest/github_objects/Issue.html#github.Issue.Issue
@ -43,7 +43,7 @@ def generate_msg_from_repo(repo_name, tag_name):
generate_msg(desc_mapping)
def find_milestone(repo, title):
def find_milestone(repo, title, lastestRelease):
"""Find the milestone in a repository that is similar to milestone title
Args:
@ -55,9 +55,21 @@ def find_milestone(repo, title):
If no milestone matches, it will return None
"""
pat = re.search("v([0-9.]+)", title)
thisRelease = title.split("/")[-1]
if not pat:
return None
version = pat.group(1)
print(f'''
---
<p align="center">
<a href="https://github.com/siyuan-note/siyuan/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/siyuan-note/siyuan/ci.yml?event=push&label=ci.yml%20Action&logo=github" style="cursor:pointer;height: 30px;margin: 3px auto;"/></a>
<a href="https://github.com/siyuan-note/siyuan/releases/{thisRelease}/"><img src="https://img.shields.io/github/downloads/siyuan-note/siyuan/{thisRelease}/total?logo=github" style="cursor:pointer;height: 30px;margin: 3px auto;"/></a>
<img alt="GitHub commits difference between two branches/tags/commits" src="https://img.shields.io/github/commits-difference/siyuan-note/siyuan?base={lastestRelease}&head={thisRelease}&logo=git" style="cursor:pointer;height: 30px;margin: 3px auto;"/>
</p>
---
''')
for milestone in repo.get_milestones():
if version in milestone.title:
return milestone
@ -88,10 +100,11 @@ if __name__ == "__main__":
description="Automaticly generate information from issues by tag."
)
parser.add_argument("-t", "--tag", help="the tag to filter issues.")
parser.add_argument("-b", "--lastestRelease", help="lastest Release")
parser.add_argument("repo", help="The repository name")
args = parser.parse_args()
try:
generate_msg_from_repo(args.repo, args.tag)
generate_msg_from_repo(args.repo, args.tag, args.lastestRelease)
except AssertionError:
print(args.tag)