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: Apply issue data and create PR | |
| on: | |
| issues: | |
| types: [opened, edited] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: read | |
| jobs: | |
| apply-and-create-pr: | |
| if: contains(github.event.issue.labels.*.name, 'data:blog') || contains(github.event.issue.labels.*.name, 'data:contest') || contains(github.event.issue.labels.*.name, 'data:group') || contains(github.event.issue.labels.*.name, 'data:material') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.repository.default_branch }} | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Compute branch name | |
| id: branch | |
| run: | | |
| BRANCH_NAME="issue/${{ github.event.issue.number }}-data-update" | |
| echo "branch_name=$BRANCH_NAME" >> "$GITHUB_OUTPUT" | |
| - name: Apply data update | |
| run: | | |
| node scripts/apply-issue-update.js | |
| env: | |
| GITHUB_EVENT_PATH: ${{ github.event_path }} | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v8.0.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| title: 'feat(data): 更新 #${{ github.event.issue.number }} 提供的信息,贡献人为${{ github.event.issue.user.login }}。' | |
| body: | | |
| 自动同步来自 Issue #${{ github.event.issue.number }} 的数据变更。 | |
| 贡献者: @${{ github.event.issue.user.login }} | |
| Closes #${{ github.event.issue.number }}. | |
| branch: ${{ steps.branch.outputs.branch_name }} | |
| base: ${{ github.event.repository.default_branch }} | |
| add-paths: | | |
| data/** | |
| commit-message: 'feat(data): 添加了 ${{ github.event.issue.title }} ,贡献人为${{ github.event.issue.user.login }}' | |
| committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
| author: ${{ github.event.issue.user.login }} <${{ github.event.issue.user.id }}+${{ github.event.issue.user.login }}@users.noreply.github.com> | |
| reviewers: qwedc001 |