Sync Dev #235
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: UpdateToRelease | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - edited | |
| branches: | |
| - master | |
| jobs: | |
| UpdateToRelease: | |
| runs-on: ubuntu-latest | |
| # 添加条件:如果是 bot 触发的则跳过,避免无限循环 | |
| if: github.event.pull_request.user.login != 'github-actions[bot]' | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Update to release | |
| run: | | |
| if [[ ${{ github.event.pull_request.head.ref }} != dev && $(git diff --name-only HEAD HEAD~1) == *XMOJ.user.js* ]]; then | |
| echo Closing PR | |
| gh pr comment ${{ github.event.pull_request.number }} --body "请向\`dev\`分支提交pull request, 本pull request将被自动关闭" | |
| gh pr close ${{ github.event.pull_request.number }} | |
| else | |
| node ./Update/UpdateToRelease.js ${{ secrets.GITHUB_TOKEN }} ${{ github.event.pull_request.number }} "$PR_BODY" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_BODY: ${{ github.event.pull_request.body }} |