From 56d3051253a7fb043e03eef3d2862424cd2cd0cf Mon Sep 17 00:00:00 2001 From: ivanberry Date: Thu, 12 Mar 2026 21:58:58 +0800 Subject: [PATCH] ci: use shared-actions/register-skill composite action --- .forgejo/workflows/register-skill-release.yml | 110 +----------------- 1 file changed, 5 insertions(+), 105 deletions(-) diff --git a/.forgejo/workflows/register-skill-release.yml b/.forgejo/workflows/register-skill-release.yml index 2a54fbc..c01abb1 100644 --- a/.forgejo/workflows/register-skill-release.yml +++ b/.forgejo/workflows/register-skill-release.yml @@ -7,111 +7,11 @@ on: workflow_dispatch: jobs: - register-skill-version: + register: runs-on: docker - env: - API_BASE: https://api-gw-test.yuanwei-lnc.com - CLIENT_KEY: ${{ secrets.CLIENT_KEY }} - SKILL_VERSION: ${{ github.ref_name }} - SKILL_SUBPATH: ${{ secrets.SKILL_SUBPATH }} - SKILL_DOC_PATH: ${{ secrets.SKILL_DOC_PATH }} - SKILL_SLUG: ${{ secrets.SKILL_SLUG }} - RELEASE_NOTE: "" - steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Load skill doc content - shell: bash - run: | - set -euo pipefail - if [ -z "${SKILL_DOC_PATH:-}" ]; then - SKILL_DOC_PATH="SKILL.md" - fi - DOC_ABS_PATH="${SKILL_SUBPATH:+$SKILL_SUBPATH/}${SKILL_DOC_PATH}" - if [ ! -f "$DOC_ABS_PATH" ]; then - if [ -f "${SKILL_SUBPATH:+$SKILL_SUBPATH/}README.md" ]; then - DOC_ABS_PATH="${SKILL_SUBPATH:+$SKILL_SUBPATH/}README.md" - export SKILL_DOC_PATH="README.md" - else - echo "skill doc not found: $DOC_ABS_PATH" - exit 1 - fi - fi - - jq -Rs . < "$DOC_ABS_PATH" > /tmp/skill_doc.json - - - name: Register version to business system - shell: bash - run: | - set -euo pipefail - - if [ -z "${API_BASE:-}" ]; then - echo "API_BASE is required." - exit 1 - fi - if [ -z "${CLIENT_KEY:-}" ]; then - echo "CLIENT_KEY is required (secret)." - exit 1 - fi - if [ -z "${SKILL_DOC_PATH:-}" ]; then - SKILL_DOC_PATH="SKILL.md" - fi - - SKILL_BASE_DIR="${SKILL_SUBPATH:-.}" - - if [ -z "${SKILL_SLUG:-}" ]; then - if [ -f "${SKILL_BASE_DIR}/package.json" ]; then - PKG_NAME=$(jq -r '.name // empty' "${SKILL_BASE_DIR}/package.json") - if [ -n "$PKG_NAME" ]; then - SKILL_SLUG="${PKG_NAME##*/}" - fi - fi - fi - - if [ -z "${SKILL_SLUG:-}" ]; then - if [ -f "${SKILL_BASE_DIR}/pyproject.toml" ]; then - PYPROJECT_NAME=$(python3 -c "import sys,tomllib; p=sys.argv[1]; d=tomllib.load(open(p,'rb')); print((d.get('project',{}).get('name') or d.get('tool',{}).get('poetry',{}).get('name') or ''))" "${SKILL_BASE_DIR}/pyproject.toml" 2>/dev/null || true) - if [ -n "$PYPROJECT_NAME" ]; then - SKILL_SLUG="${PYPROJECT_NAME##*/}" - fi - fi - fi - - if [ -z "${SKILL_SLUG:-}" ]; then - SKILL_SLUG="${GITHUB_REPOSITORY##*/}" - fi - - SESSION_RES=$(curl -sS -X POST "${API_BASE}/auth/skill-credit/session" \ - -H "Content-Type: application/json" \ - -d "{\"clientKey\":\"${CLIENT_KEY}\"}") - ACCESS_TOKEN=$(printf '%s' "$SESSION_RES" | jq -r '.accessToken // empty') - if [ -z "$ACCESS_TOKEN" ]; then - echo "failed to exchange access token from client key" - echo "$SESSION_RES" - exit 1 - fi - - RUNTIME_META=$(jq -nc --arg entry "${SKILL_SUBPATH:+$SKILL_SUBPATH/}scripts" '{entry_hint:$entry, provider:"forgejo"}') - - cat > /tmp/register_payload.json <