Skip to content

fix: sitemap.xml 输出到了错误的路径 #15

fix: sitemap.xml 输出到了错误的路径

fix: sitemap.xml 输出到了错误的路径 #15

Workflow file for this run

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: Get pull request branch
id: pr_branch
uses: actions/github-script@v7
with:
script: |
const pr_number = "${{ github.event.issue.number }}";
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr_number,
});
core.debug(`pull_number is ${pr_number}`)
core.debug(pr.data)
return pr.data.head.ref;
result-encoding: string
- name: Checkout Main Repository
uses: actions/checkout@v4
with:
ref: ${{ steps.pr_branch.outputs.result }}
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: Install dependencies
run: cd repo && pnpm i
- 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 push origin $BRANCH
- 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.