name: labels on: pull_request_target: types: - labeled - closed branches: - develop - refs/heads/develop jobs: debug: runs-on: ubuntu-latest steps: - name: log-all run: | echo ref: ${{github.ref}} echo merged: ${{github.event.pull_request.merged == true}} ${{github.event.pull_request.merged}} echo action: ${{github.event.action}} echo label: ${{github.event.label.name}} echo action-is-closed: ${{github.event.action == 'closed'}} echo set-staging-develop: ${{github.ref == 'refs/heads/develop' && github.event.action == 'closed' && github.event.pull_request.merged == true}} echo request-qa: ${{github.event.label.name == 'qa:ready' && github.event.pull_request.merged == true}} echo is backend label: ${{github.event.label.name == 'backend'}} set-staging-develop: if: github.event.action == 'closed' && github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-ecosystem/action-add-labels@v1 with: labels: "staging:develop" request-qa: if: github.event.label.name == 'qa:ready' && github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: ref: qa fetch-depth: 0 token: ${{ secrets.WORKFLOW_GIT_TOKEN }} - name: cherry-picking run: | git config user.name "Labels Bot" git config user.email "labels-bot@github.com" git status git cherry-pick ${{github.event.pull_request.merge_commit_sha}} git push - uses: actions-ecosystem/action-add-labels@v1 with: labels: "staging:qa" - uses: actions-ecosystem/action-remove-labels@v1 with: labels: | qa:ready staging:develop request-canary: if: github.event.label.name == 'canary:ready' && github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: ref: canary fetch-depth: 0 token: ${{ secrets.WORKFLOW_GIT_TOKEN }} - name: cherry-picking run: | git config user.name "Labels Bot" git config user.email "labels-bot@github.com" git cherry-pick ${{github.event.pull_request.merge_commit_sha}} git push - uses: actions-ecosystem/action-add-labels@v1 with: labels: "staging:canary" - uses: actions-ecosystem/action-remove-labels@v1 with: labels: | canary:ready staging:qa request-priority-1: if: github.event.label.name == 'priority:1' && github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: ref: qa fetch-depth: 0 token: ${{ secrets.WORKFLOW_GIT_TOKEN }} - name: cherry-picking run: | git config user.name "Labels Bot" git config user.email "labels-bot@github.com" git cherry-pick ${{github.event.pull_request.merge_commit_sha}} git push - uses: actions/checkout@v2 with: ref: canary fetch-depth: 0 token: ${{ secrets.WORKFLOW_GIT_TOKEN }} - name: cherry-picking run: | git config user.name "Labels Bot" git config user.email "labels-bot@github.com" git cherry-pick ${{github.event.pull_request.merge_commit_sha}} git push - uses: actions/checkout@v2 with: ref: main fetch-depth: 0 token: ${{ secrets.WORKFLOW_GIT_TOKEN }} - name: cherry-picking run: | git config user.name "Labels Bot" git config user.email "labels-bot@github.com" git cherry-pick ${{github.event.pull_request.merge_commit_sha}} git push - uses: actions-ecosystem/action-add-labels@v1 with: labels: "staging:main" - uses: actions-ecosystem/action-remove-labels@v1 with: labels: | staging:develop staging:qa staging:canary priority:1