fix: 无法搜索到 mdx 对应的页面 #7
This file contains 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
on: | |
issue_comment: | |
types: [ created ] | |
jobs: | |
lint_and_build: | |
name: Run CI. | |
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/lint-and-build' }} | |
permissions: | |
issues: write | |
pull-requests: write | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Reaction emoji | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'update-comment' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
comment-id: ${{ github.event.comment.id }} | |
emoji: '+1' | |
- name: Checkout Main Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
path: repo | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 9.12.x | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: 'pnpm' | |
cache-dependency-path: repo/pnpm-lock.yaml | |
- name: Lint Project | |
run: cd repo && pnpm run lint | |
- name: Build Project | |
run: cd repo && pnpm run build | |
- name: Push Project | |
run: > | |
cd repo && | |
git config --global user.name "github-actions[bot]" && | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" && | |
git add . && | |
git commit -m "chore: lint and build project" && | |
git commit -m "chore: lint project" && | |
git push origin $BRANCH | |
echo "passed=1" >> "$GITHUB_OUTPUT" | |
- name: Remove Failed Label | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'remove-labels' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} | |
labels: 'build:failed' | |
- name: Create Build Success Label | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'add-labels' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} | |
labels: 'build:success' | |
tip_ci_failed: | |
needs: lint_and_build | |
if: ${{ failure() }} | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
pull-requests: write | |
steps: | |
- name: Create label | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'add-labels' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} | |
labels: 'build:failed' | |
- name: Add failed comment | |
if: needs.lint_and_build.outputs.lint_passed != 1 | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'create-comment' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
@${{ github.event.issue.user.login }}. | |
Failed to lint or build project. [Click here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) to check the workflow. | |