docs: 添加 MCDR 插件文档 #43
Workflow file for this run
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: Branch Protection | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| jobs: | |
| check-branch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check branch source | |
| run: | | |
| if [[ "${{ github.head_ref }}" == dev/* ]] || [[ "${{ github.head_ref }}" == hotfix/* ]]; then | |
| echo "✓ Pull request is from an allowed branch: ${{ github.head_ref }}" | |
| echo "BRANCH_CHECK_RESULT=true" >> $GITHUB_ENV | |
| echo "ALLOWED_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV | |
| else | |
| echo "ERROR: Pull requests to master branch are only allowed from dev/* or hotfix/* branches." | |
| echo "Your branch: ${{ github.head_ref }}" | |
| echo "BRANCH_CHECK_RESULT=false" >> $GITHUB_ENV | |
| echo "ALLOWED_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV | |
| exit 1 | |
| fi | |
| - name: Create Job Summary | |
| run: | | |
| echo "## Master Branch Protection Check" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Branch check result: ${{ env.BRANCH_CHECK_RESULT }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Source branch: ${{ env.ALLOWED_BRANCH }}" >> $GITHUB_STEP_SUMMARY |