mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-01 17:00:21 +08:00
fix(ci): 使用认证的gh CLI替代未认证curl调用GitHub API
download-hub步骤使用未认证的curl获取release列表, 频繁触发GitHub API速率限制导致构建失败。 改用gh CLI自带GITHUB_TOKEN认证避免此问题。
This commit is contained in:
18
.github/workflows/docker-publish.yml
vendored
18
.github/workflows/docker-publish.yml
vendored
@@ -184,20 +184,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Get latest hub release tag
|
- name: Get latest hub release tag
|
||||||
id: hub-tag
|
id: hub-tag
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
TAG=$(
|
TAG=$(gh release list --repo "${{ env.GITHUB_REPO }}" --limit 50 --json tagName,isDraft,isPrerelease \
|
||||||
curl -sL "https://api.github.com/repos/${{ env.GITHUB_REPO }}/releases" | \
|
--jq '[.[] | select(.tagName | startswith("hub-v")) | select(.isDraft == false and .isPrerelease == false)] | .[0].tagName')
|
||||||
python3 - <<'PY'
|
if [ -z "$TAG" ] || [ "$TAG" = "null" ]; then
|
||||||
import json, sys
|
|
||||||
releases = json.load(sys.stdin)
|
|
||||||
for r in releases:
|
|
||||||
tag = r.get('tag_name', '')
|
|
||||||
if tag.startswith('hub-v') and not r.get('draft') and not r.get('prerelease'):
|
|
||||||
print(tag)
|
|
||||||
break
|
|
||||||
PY
|
|
||||||
)
|
|
||||||
if [ -z "$TAG" ]; then
|
|
||||||
echo "No hub release found"
|
echo "No hub release found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user