From 2a59747de59e7b94cdb6e623d3583475ebf9166b Mon Sep 17 00:00:00 2001 From: biss Date: Sun, 3 May 2026 07:38:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/people-update.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/people-update.yml b/.github/workflows/people-update.yml index 40d34f7..eb00114 100644 --- a/.github/workflows/people-update.yml +++ b/.github/workflows/people-update.yml @@ -10,6 +10,7 @@ on: permissions: contents: write issues: write + pull-requests: write jobs: update-people: @@ -31,19 +32,34 @@ jobs: ISSUE_TITLE: ${{ github.event.issue.title }} run: node scripts/update-people-from-issue.mjs - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v5 + - name: Create pull request + id: create-pr + uses: peter-evans/create-pull-request@v6 with: - commit_message: "chore: update people data from issue #${{ github.event.issue.number }}" - file_pattern: src/data/people.ts + commit-message: "chore: update people data from issue #${{ github.event.issue.number }}" + title: "更新「如今的我们」:#${{ github.event.issue.number }}" + body: | + 由 #${{ github.event.issue.number }} 自动生成。 + + 这个 PR 会根据 issue 表单更新 `src/data/people.ts`: + - 如果 `slug` 已存在,则修改对应同学资料 + - 如果 `slug` 不存在,则新增同学资料 + branch: people-update/issue-${{ github.event.issue.number }} + delete-branch: true + labels: people-update - name: Comment on issue uses: actions/github-script@v7 with: script: | + const prUrl = "${{ steps.create-pr.outputs.pull-request-url }}"; + const body = prUrl + ? `已根据这个 issue 创建更新 PR:${prUrl}\n\n如果内容需要再调整,直接编辑 issue 表单即可更新同一个 PR。` + : "这个 issue 没有产生新的文件改动,所以没有创建 PR。"; + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - body: "已根据这个 issue 更新 `src/data/people.ts`。如果内容需要再调整,直接编辑 issue 表单即可再次触发。" + body });