solutions for opensearch (#128) #592
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
| name: Build and Update | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: [opened, synchronize] | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
| runs-on: ubuntu-latest | |
| environment: translate | |
| env: | |
| AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | |
| AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} | |
| XSY_CLIENT_ID: ${{ secrets.XSY_CLIENT_ID }} | |
| XSY_CLIENT_SECRET: ${{ secrets.XSY_CLIENT_SECRET }} | |
| XSY_PASSWORD: ${{ secrets.XSY_PASSWORD }} | |
| XSY_USERNAME: ${{ secrets.XSY_USERNAME }} | |
| RAW_TERMS_URL: https://gist.github.com/JounQin/8f323563651794ec371588c0d5c3bf1b/raw/71f1eae4f5744e4a78b95244c1d1fa9305d8c471/terms.yaml | |
| AZURE_OPENAI_MODEL: gpt-4o-mini | |
| permissions: | |
| contents: write # 必需:允许 push 到 PR | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' # 可根据项目调整 | |
| - name: Setup Yarn | |
| run: | | |
| corepack enable | |
| yarn set version stable | |
| # - name: Upgrade dependencies | |
| # run: | | |
| # yarn up @alauda/doom | |
| # yarn up -R '**' | |
| - name: Install dependencies (immutable) | |
| run: yarn --immutable | |
| - name: generate id | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: ./add_id.sh docs/en/solutions && ./add_id.sh docs/en/articles | |
| - name: translate | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: yarn translate -s en -t zh -g "*" | |
| - name: Build | |
| run: yarn build | |
| - name: Commit | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -m "ci: update file from GitHub Action [skip ci]" || echo "Nothing to commit" | |
| - name: Push changes | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: ad-m/github-push-action@master | |
| with: | |
| branch: ${{ github.ref }} | |
| github_token: ${{ secrets.KNOWLEDGE_SECRET }} |