[tools] Add Toolpad to repo we check missing labels against #21
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: Cherry pick onto target branch | |
| on: | |
| pull_request_target: | |
| branches: | |
| - 'v*.x' | |
| - 'master' | |
| types: ['closed'] | |
| workflow_call: | |
| permissions: {} | |
| jobs: | |
| detect_cherry_pick_target: | |
| runs-on: ubuntu-latest | |
| name: Detect cherry-pick target branch | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| contents: write | |
| if: ${{ contains(github.event.pull_request.labels.*.name, 'needs cherry-pick') && github.event.pull_request.merged == true }} | |
| outputs: | |
| targetBranch: ${{ steps.detect.outputs.TARGET_BRANCH }} | |
| transferLabels: ${{ steps.detect.outputs.TRANSFER_LABELS }} | |
| steps: | |
| - name: Check out mui-public repo | |
| id: checkout | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| # Check this repository out, otherwise the script won't be available, | |
| # as it otherwise checks out the repository where the workflow caller is located | |
| repository: mui/mui-public | |
| - name: Detect target | |
| id: detect | |
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
| with: | |
| script: | | |
| const script = require('./.github/workflows/scripts/prs/detectTargetBranch.js') | |
| await script({core, github, context}) | |
| open_cherry_pick_pr: | |
| runs-on: ubuntu-latest | |
| name: Open cherry-pick PR with target branch | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| contents: write | |
| needs: detect_cherry_pick_target | |
| if: needs.detect_cherry_pick_target.outputs.targetBranch != '' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| - name: Cherry pick and create the new PR | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| uses: carloscastrojumo/github-cherry-pick-action@503773289f4a459069c832dc628826685b75b4b3 # v1.0.10 | |
| with: | |
| branch: ${{ needs.detect_cherry_pick_target.outputs.targetBranch }} | |
| body: 'Cherry-pick of #{old_pull_request_id}' | |
| cherry-pick-branch: ${{ format('cherry-pick-{0}', github.event.number) }} | |
| title: '{old_title} (@${{ github.event.pull_request.user.login }})' | |
| labels: ${{ needs.detect_cherry_pick_target.outputs.transferLabels }} |