diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1fb91f829..8e221f191f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,31 +4,39 @@ on: push: branches: - next - + - V3.0 pull_request: branches: - next - + - V3.0 + pull_request_target: + types: [opened, synchronize, reopened] workflow_dispatch: +permissions: write-all + jobs: - label: + add-label: runs-on: ubuntu-latest steps: - - name: Check out the repository + - name: Check out repository uses: actions/checkout@v4 - - name: Determine label - id: determine_label + - name: Determine label based on target branch + id: determine-label run: | + echo "${{github.event_name}}" if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then echo "label=2.x" >> $GITHUB_ENV elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then echo "label=3.x" >> $GITHUB_ENV + else + echo "label=" >> $GITHUB_ENV fi - - name: Add label to PR + - name: Add label to Pull Request + if: github.event_name == 'pull_request_target' && env.label != '' uses: actions-ecosystem/action-add-labels@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }}