Update Test Branch #167
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: Update Test Branch | |
| on: | |
| schedule: | |
| - cron: '0 20 * * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| update-test-branch: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.repository_owner == 'OneDragon-Anything' }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Attempt to Fast-Forward Merge | |
| id: merge-attempt | |
| continue-on-error: true | |
| run: | | |
| git checkout test | |
| git pull origin main --ff-only | |
| git push origin test | |
| - name: Find Comment | |
| if: steps.merge-attempt.outcome == 'failure' | |
| uses: peter-evans/find-comment@v3 | |
| id: fc | |
| with: | |
| issue-number: ${{ vars.SYNC_STATUS_ISSUE_NUMBER }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: 检测到合并冲突 | |
| - name: Post a Comment on Failure | |
| if: steps.merge-attempt.outcome == 'failure' | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| comment-id: ${{ steps.fc.outputs.comment-id }} | |
| issue-number: ${{ vars.SYNC_STATUS_ISSUE_NUMBER }} | |
| body: | | |
| > :warning: **检测到合并冲突** | |
| @${{ vars.ASSIGNEE_USERNAME }} | |
| `test` 分支和 `main` 分支有冲突,无法自动更新。 | |
| edit-mode: replace |