chore: update bailian-docs-llm-wiki (2026-07-29) (#56)

* chore: update bailian-docs-llm-wiki (2026-07-15)

* chore: update bailian-docs-llm-wiki (2026-07-15)

* chore: update bailian-docs-llm-wiki (2026-07-23)

* Add GitHub Actions workflow for skill publishing

* Update publish-skills workflow branch to feat/bailian-docs-update

Change the branch for triggering the publish-skills workflow.

* feat: trigger git action

* chore: update bailian-docs-llm-wiki (2026-07-24)

* chore: update bailian-docs-llm-wiki (2026-07-24)

* chore: update bailian-docs-llm-wiki (2026-07-25)

* chore: update bailian-docs-llm-wiki (2026-07-26)

* chore: update bailian-docs-llm-wiki (2026-07-27)

* chore: optimize workflow - auto PR & merge to main, remove Chinese comments

* chore: update bailian-docs-llm-wiki (2026-07-29)

* feat: update publish.yml

* feat: update workflow

* chore: update bailian-docs-llm-wiki (2026-07-29)

* ci: sync main back into branch before PR and fix PR number parsing

* ci: use REST API to update PR title (repo scope only)

---------

Co-authored-by: bailian-bot <bailian-bot@alibaba-inc.com>
This commit is contained in:
gujieye
2026-07-29 15:56:20 +08:00
committed by GitHub
parent b90d6b73db
commit 7b49d71665
217 changed files with 18343 additions and 16884 deletions
+90
View File
@@ -0,0 +1,90 @@
name: auto-merge-to-main
# The FC crawler pushes skill updates to feat/bailian-docs-update.
# On each such push, create (or reuse) a PR to main and merge it.
# The resulting push to main then triggers publish-skills.yml,
# which pokes the remote FC to sync main -> OSS.
on:
push:
branches: [feat/bailian-docs-update]
paths: ['skills/**']
permissions:
contents: write
pull-requests: write
concurrency:
group: auto-merge-to-main
cancel-in-progress: false
jobs:
merge:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sync main back into branch (prevent squash-merge conflicts)
run: |
# Squash-merging PRs rewrites history on main, so this branch
# diverges from main after every merge and later PRs conflict.
# Merge main back in first, preferring the branch (crawler output
# is the source of truth for skills/**) on conflicting hunks.
# Pushing with the default GITHUB_TOKEN does NOT retrigger this
# workflow (recursive triggers are suppressed), so no loop.
BRANCH="${{ github.ref_name }}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin main
if ! git merge-base --is-ancestor origin/main HEAD; then
git merge -X ours --no-edit origin/main
git push origin "HEAD:${BRANCH}"
fi
- name: Create or update PR to main
id: pr
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
BRANCH="${{ github.ref_name }}"
# Use the latest commit subject as the PR title (fallback to default title)
TITLE=$(git log -1 --pretty=%s "${{ github.sha }}")
[ -n "$TITLE" ] || TITLE="chore: update bailian-docs-llm-wiki ($(TZ=Asia/Shanghai date +%Y-%m-%d))"
EXISTING_PR=$(gh pr list --head "$BRANCH" --base main --state open --json number --jq '.[0].number')
if [ -n "$EXISTING_PR" ]; then
echo "PR #$EXISTING_PR already exists, updating..."
# gh pr edit uses GraphQL and needs read:org scope; the REST
# endpoint only needs repo scope, which GIT_TOKEN has.
gh api "repos/${{ github.repository }}/pulls/$EXISTING_PR" \
-X PATCH -f title="$TITLE" --silent
PR_NUMBER="$EXISTING_PR"
else
echo "Creating new PR..."
PR_URL=$(gh pr create \
--base main \
--head "$BRANCH" \
--title "$TITLE" \
--body "Automated PR created on push to \`${BRANCH}\`." \
--no-maintainer-edit)
# gh pr create prints the PR URL; keep only the trailing number
PR_NUMBER="${PR_URL##*/}"
fi
echo "number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
- name: Auto-merge PR
env:
# GIT_TOKEN is a classic PAT (repo scope, no expiration) so that
# the merge commit fires publish-skills.yml on main.
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
PR_NUMBER="${{ steps.pr.outputs.number }}"
echo "Merging PR #$PR_NUMBER..."
gh pr merge "$PR_NUMBER" --squash --delete-branch=false
echo "### PR #$PR_NUMBER merged" >> "$GITHUB_STEP_SUMMARY"
echo "Branch \`${{ github.ref_name }}\` has been merged into \`main\`." >> "$GITHUB_STEP_SUMMARY"
+5 -45
View File
@@ -1,13 +1,15 @@
name: publish-skills
# Fires on pushes to main (including auto-merged PRs from
# feat/bailian-docs-update) and pokes the remote FC publisher,
# which syncs main -> OSS on its own (not part of this repo).
on:
push:
branches: [feat/bailian-docs-update]
branches: [main]
paths: ['skills/**']
permissions:
contents: write
pull-requests: write
contents: read
concurrency:
group: publish-skills
@@ -17,11 +19,6 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Poke FC publisher (publish-skills)
run: |
# FC uses reconciliation-based publishing: request body is not trusted.
@@ -39,40 +36,3 @@ jobs:
echo '```json' >> "$GITHUB_STEP_SUMMARY"
echo "$RESP" | jq '{upserted, deleted, unchanged: (.unchanged | length), durationMs}' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
- name: Create or update PR to main
id: pr
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="${{ github.ref_name }}"
TITLE="Auto PR: merge ${BRANCH} into main"
EXISTING_PR=$(gh pr list --head "$BRANCH" --base main --state open --json number --jq '.[0].number')
if [ -n "$EXISTING_PR" ]; then
echo "PR #$EXISTING_PR already exists, updating..."
gh pr edit "$EXISTING_PR" --title "$TITLE"
PR_NUMBER="$EXISTING_PR"
else
echo "Creating new PR..."
PR_NUMBER=$(gh pr create \
--base main \
--head "$BRANCH" \
--title "$TITLE" \
--body "Automated PR created on push to \`${BRANCH}\`." \
--no-maintainer-edit)
fi
echo "number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
- name: Auto-merge PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER="${{ steps.pr.outputs.number }}"
echo "Merging PR #$PR_NUMBER..."
gh pr merge "$PR_NUMBER" --squash --delete-branch=false
echo "### PR #$PR_NUMBER merged" >> "$GITHUB_STEP_SUMMARY"
echo "Branch \`${{ github.ref_name }}\` has been merged into \`main\`." >> "$GITHUB_STEP_SUMMARY"