-
Notifications
You must be signed in to change notification settings - Fork 0
init version #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
init version #1
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| name: Azure Static Web Apps CI/CD - Docs | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| types: [ opened, synchronize, reopened, closed ] | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| build_and_deploy_job: | ||
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') | ||
| runs-on: ubuntu-latest | ||
| name: Build and Deploy Job Docs | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| NODE_VERSION: "20" | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| cache: "npm" | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Install playwright browsers | ||
| run: npx playwright install --with-deps | ||
|
|
||
| - name: Build docs | ||
| run: NODE_ENV=production npm run build | ||
| env: | ||
| CLARITY_PROJECT_ID: ${{ secrets.CLARITY_PROJECT_ID }} | ||
|
|
||
| - name: Build And Deploy | ||
| id: builddeploy | ||
| uses: Azure/static-web-apps-deploy@v1 | ||
| with: | ||
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ASHY_FLOWER_DOCS }} | ||
| repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
| action: "upload" | ||
| app_location: "dist" | ||
| api_location: "" | ||
| skip_app_build: true | ||
|
|
||
| close_pull_request_job: | ||
| if: github.event_name == 'pull_request' && github.event.action == 'closed' | ||
| runs-on: ubuntu-latest | ||
| name: Close Pull Request Job | ||
| steps: | ||
| - name: Close Pull Request | ||
| id: closepullrequest | ||
| uses: Azure/static-web-apps-deploy@v1 | ||
| with: | ||
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ASHY_FLOWER_DOCS }} | ||
| action: "close" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,232 @@ | ||
| name: Version Monitor | ||
|
|
||
| # Trigger the workflow every 30 minutes and allow manual triggering | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| schedule: | ||
| - cron: "*/30 * * * *" # Run every 30 minutes | ||
| workflow_dispatch: # Allow manual trigger from GitHub Actions UI | ||
|
|
||
| # Set permissions for creating branches, commits, and pull requests | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| monitor: | ||
| name: Monitor Version Changes | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| update_needed: ${{ steps.monitor.outputs.update_needed }} | ||
| new_version: ${{ steps.monitor.outputs.new_version }} | ||
| pr_created: ${{ steps.pr.outputs.pr_created }} | ||
| pr_url: ${{ steps.pr.outputs.pr_url }} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
|
|
||
| - name: Display configuration | ||
| run: | | ||
| echo "Version Monitor Configuration" | ||
| echo "==========================" | ||
| echo "Source URL: ${{ vars.VERSION_SOURCE_URL || 'https://desktop.dl.hagicode.com/index.json' }}" | ||
| echo "Request Timeout: 30000ms" | ||
| echo "Max Retries: 3" | ||
| echo "Repository: ${{ github.repository }}" | ||
|
|
||
| - name: Run version monitor | ||
| id: monitor | ||
| run: node scripts/version-monitor.js | ||
| env: | ||
| VERSION_SOURCE_URL: ${{ vars.VERSION_SOURCE_URL || 'https://desktop.dl.hagicode.com/index.json' }} | ||
| REQUEST_TIMEOUT: "30000" | ||
| MAX_RETRIES: "3" | ||
|
|
||
| - name: Configure Git | ||
| if: steps.monitor.outputs.update_needed == 'true' | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Check existing branch | ||
| id: check_branch | ||
| if: steps.monitor.outputs.update_needed == 'true' | ||
| run: | | ||
| BRANCH_NAME="version-update-${{ steps.monitor.outputs.new_version }}" | ||
| echo "Checking for existing branch: $BRANCH_NAME" | ||
| if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then | ||
| echo "branch_exists=true" >> $GITHUB_OUTPUT | ||
| echo "Branch $BRANCH_NAME already exists on remote" | ||
| else | ||
| echo "branch_exists=false" >> $GITHUB_OUTPUT | ||
| echo "Branch $BRANCH_NAME does not exist on remote" | ||
| fi | ||
|
|
||
| - name: Create feature branch | ||
| if: steps.monitor.outputs.update_needed == 'true' && steps.check_branch.outputs.branch_exists != 'true' | ||
| run: | | ||
| BRANCH_NAME="version-update-${{ steps.monitor.outputs.new_version }}" | ||
| git checkout -b "$BRANCH_NAME" | ||
| echo "Created branch: $BRANCH_NAME" | ||
|
|
||
| - name: Commit version changes | ||
| if: steps.monitor.outputs.update_needed == 'true' && steps.check_branch.outputs.branch_exists != 'true' | ||
| run: | | ||
| git add public/version-index.json | ||
| git commit -m "chore: update version to ${{ steps.monitor.outputs.new_version }}" | ||
|
|
||
| - name: Push branch | ||
| if: steps.monitor.outputs.update_needed == 'true' && steps.check_branch.outputs.branch_exists != 'true' | ||
| run: | | ||
| BRANCH_NAME="version-update-${{ steps.monitor.outputs.new_version }}" | ||
| git push origin "$BRANCH_NAME" | ||
|
|
||
| - name: Check existing PR | ||
| id: check_pr | ||
| if: steps.monitor.outputs.update_needed == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| CURRENT_VERSION: ${{ steps.monitor.outputs.new_version }} | ||
| run: | | ||
| echo "Checking for existing PR for version: ${CURRENT_VERSION}" | ||
| EXISTING_PR=$(gh pr list \ | ||
| --search "chore: update version to ${CURRENT_VERSION} in:head" \ | ||
| --state open \ | ||
| --json number,title \ | ||
| --jq '.[0]') | ||
|
|
||
| if [ -n "$EXISTING_PR" ]; then | ||
| PR_NUMBER=$(echo "$EXISTING_PR" | jq -r '.number') | ||
| PR_TITLE=$(echo "$EXISTING_PR" | jq -r '.title') | ||
| echo "pr_exists=true" >> $GITHUB_OUTPUT | ||
| echo "existing_pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT | ||
| echo "existing_pr_url=$(gh pr view $PR_NUMBER --json url -q .url)" >> $GITHUB_OUTPUT | ||
| echo "Found existing PR: #$PR_NUMBER - $PR_TITLE" | ||
| else | ||
| echo "pr_exists=false" >> $GITHUB_OUTPUT | ||
| echo "No existing PR found for version ${CURRENT_VERSION}" | ||
| fi | ||
|
|
||
| - name: Close previous version PRs | ||
| id: close_prs | ||
| if: steps.monitor.outputs.update_needed == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| CURRENT_VERSION: ${{ steps.monitor.outputs.new_version }} | ||
| run: | | ||
| echo "Closing previous version PRs (excluding current version: ${CURRENT_VERSION})..." | ||
| PREVIOUS_PRS=$(gh pr list \ | ||
| --search "chore: update version to in:head" \ | ||
| --state open \ | ||
| --json number,title \ | ||
| --jq '.[] | select(.title != "chore: update version to '"${CURRENT_VERSION}"'") | .number') | ||
|
|
||
| if [ -n "$PREVIOUS_PRS" ]; then | ||
| echo "$PREVIOUS_PRS" | while read -r pr_number; do | ||
| echo "Closing PR #$pr_number" | ||
| gh pr close "$pr_number" --comment "由于新的版本更新 PR 自动关闭" | ||
| done | ||
| else | ||
| echo "No previous version PRs to close" | ||
| fi | ||
|
|
||
| - name: Create Pull Request | ||
| id: pr | ||
| if: steps.monitor.outputs.update_needed == 'true' && steps.check_pr.outputs.pr_exists != 'true' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| NEW_VERSION="${{ steps.monitor.outputs.new_version }}" | ||
| BRANCH_NAME="version-update-${NEW_VERSION}" | ||
| PR_BODY="## Version Update | ||
|
|
||
| This PR updates the version index to reflect the new version detected from the official website. | ||
|
|
||
| - **New Version**: ${NEW_VERSION} | ||
| - **Source**: ${{ vars.VERSION_SOURCE_URL || 'https://desktop.dl.hagicode.com/index.json' }} | ||
| - **Checked At**: $(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
|
|
||
| ### Changes | ||
| - Updated \`public/version-index.json\` with the latest version data from online API | ||
|
|
||
| ### Next Steps | ||
| After merging this PR, the CI/CD pipeline will automatically rebuild and deploy the documentation site with the updated version information. | ||
|
|
||
| --- | ||
| _This PR was automatically created by the [Version Monitor](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) workflow._" | ||
|
|
||
| gh pr create \ | ||
| --title "chore: update version to ${NEW_VERSION}" \ | ||
| --body "$PR_BODY" \ | ||
| --base main \ | ||
| --head "$BRANCH_NAME" \ | ||
| --label "automation,version" | ||
|
|
||
| echo "pr_created=true" >> $GITHUB_OUTPUT | ||
| echo "pr_url=$(gh pr view --json url -q .url)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Display result | ||
| if: always() | ||
| run: | | ||
| echo "Version Monitor Result" | ||
| echo "======================" | ||
| echo "Update Needed: ${{ steps.monitor.outputs.update_needed }}" | ||
| echo "New Version: ${{ steps.monitor.outputs.new_version }}" | ||
| echo "Branch Exists: ${{ steps.check_branch.outputs.branch_exists }}" | ||
| echo "PR Exists: ${{ steps.check_pr.outputs.pr_exists }}" | ||
| echo "PR Created: ${{ steps.pr.outputs.pr_created }}" | ||
| if [ "${{ steps.check_pr.outputs.pr_exists }}" == "true" ]; then | ||
| echo "Existing PR: #${{ steps.check_pr.outputs.existing_pr_number }}" | ||
| echo "Existing PR URL: ${{ steps.check_pr.outputs.existing_pr_url }}" | ||
| else | ||
| echo "PR URL: ${{ steps.pr.outputs.pr_url }}" | ||
| fi | ||
|
|
||
| notify-version-update: | ||
| needs: monitor | ||
| if: needs.monitor.outputs.pr_created == 'true' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: HagiCode-org/haginotifier@v1 | ||
| with: | ||
| msg_type: 'post' | ||
| title: 'Version Monitor' | ||
| message: | | ||
| ## Version Monitor | ||
|
|
||
| **状态**: 🔄 发现新版本 | ||
| **新版本**: ${{ needs.monitor.outputs.new_version }} | ||
| **仓库**: ${{ github.repository }} | ||
| **PR 链接**: ${{ needs.monitor.outputs.pr_url }} | ||
| **运行详情**: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| env: | ||
| FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }} | ||
|
|
||
| notify-failure: | ||
| needs: monitor | ||
| if: failure() | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: HagiCode-org/haginotifier@v1 | ||
| with: | ||
| msg_type: 'post' | ||
| title: 'Version Monitor' | ||
| message: | | ||
| ## Version Monitor | ||
|
|
||
| **状态**: ❌ 失败 | ||
| **仓库**: ${{ github.repository }} | ||
| **触发者**: ${{ github.actor }} | ||
| **运行详情**: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| env: | ||
| FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
| .pnp/ | ||
| .pnp.js | ||
|
|
||
| # Turbo | ||
| .turbo/ | ||
|
|
||
| # Testing | ||
| coverage/ | ||
|
|
||
| # Production | ||
| build/ | ||
| .dist/ | ||
| dist/ | ||
|
|
||
| # Misc | ||
| .DS_Store | ||
| *.pem | ||
|
|
||
| # Debug | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # Local env files | ||
| .env | ||
| .env.local | ||
| .env.*.local | ||
|
|
||
| # Docusaurus | ||
| .docusaurus/ | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS | ||
| Thumbs.db | ||
|
|
||
| .claude/skills/ui-ux-pro-max/scripts/__pycache__/ | ||
| .astro/ | ||
| tsconfig.tsbuildinfo |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
GitHub CLI gh pr list search qualifiers valid options💡 Result:
gh pr list --search "<query>"accepts the same GitHub “issues & pull requests” search syntax (qualifiers) you use on GitHub.com. [1][2]Common PR search qualifiers (valid in
--search)Scope / state
is:pr(often implied forgh pr list, but useful when combining terms) [2]state:open/state:closed(alsois:open/is:closed) [2]is:merged/is:unmerged[3]is:queued(in merge queue) [2]Draft / review / CI
draft:true/draft:false(also commonlyis:draft) [4][5]review:none | required | approved | changes_requested[4][5]reviewed-by:USER,review-requested:USER,user-review-requested:@me``,team-review-requested:ORG/TEAM[4][5]status:success | failure | pending[5]Branches / commits
head:BRANCHPREFIX,base:BRANCH[6]<SHA>(commit SHA prefix) [6]People / metadata
author:USER(includingauthor:@me``,author:app/APPNAME) [2]assignee:USER,mentions:USER,commenter:USER,involves:USER,team:ORG/TEAM[2][5]label:"name",milestone:"name"[2]linked:issue(PRs linked to an issue they may close) [5]archived:true|false[3]Dates / sorting / counts
merged:>=YYYY-MM-DD(ISO date; supports>,<, ranges, optional time) [3]comments:>N, pluscreated:,updated:,closed:(date qualifiers) [3]sort:created-asc(and othersort:options) [5]Examples
gh pr list --search "review:required status:success"[1][4][5]gh pr list --search "is:open user-review-requested:@me"[4]mainfrom feature branches:gh pr list --search "base:main head:feature-"[6]gh pr list --search "is:merged merged:>=2026-01-01"[3]Tip:
gh pr listalso has dedicated flags (e.g.,--author,--assignee,--base,--head,--draft) that overlap with some qualifiers. [1]🌐 Web query:
GitHub search qualifier "in:title" "in:body" "in:comments" pull requests valid💡 Result:
Yes—
in:title,in:body, andin:commentsare valid GitHub Issues & Pull Requests search qualifiers, and they work for pull requests as long as you restrict the search to PRs withis:pr(ortype:pr). GitHub documents these under “Searching issues and pull requests” → “Search by the title, body, or comments.” [1]Examples:
is:pr in:title "my phrase"[1]is:pr in:body "my phrase"[1]is:pr in:comments "my phrase"[1]is:pr "my phrase" in:title,body[1]Sources:
[1] GitHub Docs — “Searching issues and pull requests” (sections: “Search only issues or pull requests” and “Search by the title, body, or comments”). (docs.github.com)
Citations:
🌐 Web query:
GitHub search qualifier "in:head" pull requests💡 Result:
in:headis not a valid GitHub qualifier for searching pull requests.In issues/PR search, the
in:qualifier only limits where text is searched (e.g.in:title,in:body,in:comments). [1]To search PRs by branch, use these PR-specific qualifiers instead: [1]
head:<branch>base:<branch>Examples:
feature/login(in any repo you can access):is:pr head:feature/loginmainin a specific repo:repo:OWNER/REPO is:pr base:mainSources
[1] GitHub Docs — “Searching issues and pull requests” (includes
in:andhead:/base:qualifiers) (docs.github.com)Citations:
🏁 Script executed:
Repository: HagiCode-org/docs
Length of output: 102
🏁 Script executed:
sed -n '120,140p' .github/workflows/version-monitor.ymlRepository: HagiCode-org/docs
Length of output: 985
in:headis not a valid GitHub search qualifier — fix to usein:titleto prevent duplicate PRs.The search qualifier
in:headis not recognized by GitHub's search API. Validin:qualifiers are limited toin:title,in:body, andin:comments. When using invalid qualifiers, GitHub treats them as literal search text rather than filters, causing the query to fail silently and never match existing PRs. This will cause the workflow to create duplicate version-update PRs.Update both occurrences:
Line ~104
Line ~129
📝 Committable suggestion
🤖 Prompt for AI Agents