Skip to content

Commit

Permalink
add auto generate changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
xishang0128 committed Jan 14, 2025
1 parent db71bc3 commit 58040ee
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
41 changes: 38 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ jobs:
tag_name: pre-release
body_path: changelog.md
files: |
bin/latest.yml
bin/dist/*
prerelease: true

Expand All @@ -131,6 +130,41 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
fetch-tags: 'true'

- name: Generate Changelog
env:
API_URL: ${{ secrets.API_URL }}
API_KEY: ${{ secrets.API_KEY }}
run: |
TEXT=$(git log $(jq -r .version package.json)..HEAD --pretty=format:%s | grep -v '[0-9]\+\.[0-9]\+\.[0-9]\+$' | sed ':a;N;$!ba;s/\n/\\n/g')
QUESTION="Translate into Chinese:\n"""\n$TEXT\n""""
PAYLOAD=$(cat <<EOF
{
"stream": false,
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You are a professional translation engine, please translate the text into a colloquial, professional, elegant and fluent content, without the style of machine translation. You must only translate the text content, never interpret it."
},
{
"role": "user",
"content": "$QUESTION"
}
]
}
EOF
)
RESPONSE=$(curl -s -X POST "$API_URL/v1/chat/completions" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
--max-time 30)
echo '# 更新日志' > changelog.md
echo $RESPONSE | jq .choices[0].message.content -r | sed 's/\\n/\n/g' >> changelog.md
- name: Update Version
run: |
Expand All @@ -141,6 +175,7 @@ jobs:
exit 1
fi
jq --arg version "$CLEAN_VERSION" '.version = $version' package.json > tmp.json && mv tmp.json package.json
echo "version: $CLEAN_VERSION" > latest.yml
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
Expand All @@ -165,7 +200,7 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.version != '' && github.event.inputs.version || github.ref }}
body_path: bin/changelog.md
body_path: changelog.md
files: |
bin/latest.yml
latest.yml
bin/dist/*
6 changes: 1 addition & 5 deletions src/renderer/src/components/resources/proxy-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ const ProxyProvider: React.FC = () => {
if (!data) return []
return Object.values(data.providers)
.map(provider => {
if (provider.vehicleType === 'Inline' || (provider.subscriptionInfo &&
provider.subscriptionInfo.Upload === 0 &&
provider.subscriptionInfo.Download === 0 &&
provider.subscriptionInfo.Total === 0 &&
provider.subscriptionInfo.Expire === 0)) {
if (provider.vehicleType === 'Inline' || provider.vehicleType === 'File') {
return {
...provider,
subscriptionInfo: null
Expand Down

0 comments on commit 58040ee

Please sign in to comment.