.github: Fix CherryPickTest to only run when it should
Fixed CherryPickTest so it triggers only on the
"cherry-pick-test" label instead of all labels.
(cherry picked from commit 9097fc7515
)
This commit is contained in:
parent
272fbca4d0
commit
9a1ac9142f
|
@ -1,32 +1,31 @@
|
||||||
name: CherryPickTest
|
name: CherryPickTest
|
||||||
run-name: "Cherry-Pick Tests for PR ${{github.event.number || inputs.pr_number}}"
|
run-name: "Cherry-Pick Tests for PR ${{github.event.number}}"
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [ labeled ]
|
types: [ labeled ]
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
pr_number:
|
|
||||||
description: 'PR number'
|
|
||||||
required: true
|
|
||||||
type: number
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{github.workflow}}-${{github.event.number || inputs.pr_number }}
|
group: ${{github.workflow}}-${{github.event.number}}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PR_NUMBER: ${{ github.event.number || inputs.pr_number }}
|
PR_NUMBER: ${{ github.event.number }}
|
||||||
MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }} ${{ vars.UNITTEST_MODULES_BLACKLIST }}
|
MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }} ${{ vars.UNITTEST_MODULES_BLACKLIST }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
IdentifyBranches:
|
IdentifyBranches:
|
||||||
name: IdentifyBranches
|
name: IdentifyBranches
|
||||||
if: github.event.label.name == ${{vars.CHERRY_PICK_TEST_LABEL}}
|
if: ${{ github.event.label.name == vars.CHERRY_PICK_TEST_LABEL }}
|
||||||
outputs:
|
outputs:
|
||||||
branches: ${{ steps.getbranches.outputs.branches }}
|
branches: ${{ steps.getbranches.outputs.branches }}
|
||||||
branch_count: ${{ steps.getbranches.outputs.branch_count }}
|
branch_count: ${{ steps.getbranches.outputs.branch_count }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: DumpEnvironment
|
||||||
|
uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main
|
||||||
|
with:
|
||||||
|
action-vars: ${{toJSON(vars)}}
|
||||||
|
|
||||||
- name: Remove Trigger Label, Add InProgress Label
|
- name: Remove Trigger Label, Add InProgress Label
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -37,7 +36,7 @@ jobs:
|
||||||
--remove-label ${{vars.CHERRY_PICK_CHECKS_FAILED_LABEL}} \
|
--remove-label ${{vars.CHERRY_PICK_CHECKS_FAILED_LABEL}} \
|
||||||
--remove-label ${{vars.CHERRY_PICK_GATES_PASSED_LABEL}} \
|
--remove-label ${{vars.CHERRY_PICK_GATES_PASSED_LABEL}} \
|
||||||
--remove-label ${{vars.CHERRY_PICK_GATES_FAILED_LABEL}} \
|
--remove-label ${{vars.CHERRY_PICK_GATES_FAILED_LABEL}} \
|
||||||
--add-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \
|
--remove-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \
|
||||||
${{env.PR_NUMBER}} || :
|
${{env.PR_NUMBER}} || :
|
||||||
|
|
||||||
- name: Get cherry-pick branches
|
- name: Get cherry-pick branches
|
||||||
|
@ -49,9 +48,18 @@ jobs:
|
||||||
cherry_pick_regex: ${{vars.CHERRY_PICK_REGEX}}
|
cherry_pick_regex: ${{vars.CHERRY_PICK_REGEX}}
|
||||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
|
||||||
|
- name: Check Branch Count
|
||||||
|
if: ${{ steps.getbranches.outputs.branch_count > 0 }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
gh pr edit --repo ${{github.repository}} \
|
||||||
|
--add-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \
|
||||||
|
${{env.PR_NUMBER}} || :
|
||||||
|
|
||||||
AsteriskUnitTestMatrix:
|
AsteriskUnitTestMatrix:
|
||||||
needs: [ IdentifyBranches ]
|
needs: [ IdentifyBranches ]
|
||||||
if: needs.IdentifyBranches.outputs.branch_count > 0
|
if: ${{ needs.IdentifyBranches.outputs.branch_count > 0 && ( success() || failure() ) }}
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -71,9 +79,9 @@ jobs:
|
||||||
unittest_command: ${{vars.UNITTEST_COMMAND}}
|
unittest_command: ${{vars.UNITTEST_COMMAND}}
|
||||||
|
|
||||||
AsteriskUnitTests:
|
AsteriskUnitTests:
|
||||||
if: ${{ always() }}
|
needs: [ IdentifyBranches, AsteriskUnitTestMatrix ]
|
||||||
|
if: ${{ needs.IdentifyBranches.outputs.branch_count > 0 && ( success() || failure() ) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ AsteriskUnitTestMatrix ]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check unit test matrix status
|
- name: Check unit test matrix status
|
||||||
env:
|
env:
|
||||||
|
@ -131,9 +139,9 @@ jobs:
|
||||||
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
|
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
|
||||||
|
|
||||||
AsteriskGateTests:
|
AsteriskGateTests:
|
||||||
if: ${{ always() }}
|
needs: [ IdentifyBranches, AsteriskGateTestMatrix ]
|
||||||
|
if: ${{ success() || failure() }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: AsteriskGateTestMatrix
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check test matrix status
|
- name: Check test matrix status
|
||||||
env:
|
env:
|
||||||
|
|
Loading…
Reference in New Issue