mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	.github: OnPRCherryPickTest,OnPRStateChanged,OnPRRecheck: Add job summaries.
...and refactor environment variables.
(cherry picked from commit 478fbbb828)
			
			
This commit is contained in:
		
				
					committed by
					
						 Asterisk Development Team
						Asterisk Development Team
					
				
			
			
				
	
			
			
			
						parent
						
							d970e14a4d
						
					
				
				
					commit
					e10c33d251
				
			
							
								
								
									
										183
									
								
								.github/workflows/OnPRCherryPickTest.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										183
									
								
								.github/workflows/OnPRCherryPickTest.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,15 +1,30 @@ | ||||
| name: PRCPCheck | ||||
| run-name: "PR ${{ github.event.number }} CherryPickTest" | ||||
| run-name: "PR ${{ github.event.number }} CherryPickTest by ${{ github.actor }}" | ||||
| on: | ||||
|   pull_request_target: | ||||
|     types: [ labeled ] | ||||
|  | ||||
| concurrency: | ||||
|   group: ${{ github.workflow }}-${{ github.event.label.name }}-${{ github.event.number }} | ||||
|   group: ${{ github.event.label.name }}-${{ github.event.number }} | ||||
|   cancel-in-progress: true | ||||
|  | ||||
| env: | ||||
|   PR_NUMBER: ${{ github.event.number }} | ||||
|   REPO:            ${{ github.repository }} | ||||
|   REPO_DIR:        ${{ github.workspace }}/${{ github.event.repository.name }} | ||||
|   REPO_ORG:        ${{ github.event.repository.owner.login }} | ||||
|   PR_NUMBER:       ${{ github.event.number }} | ||||
|   WORKFLOW_NAME:   ${{ github.workflow }} | ||||
|   WORKFLOW_RUN_ID: ${{ github.run_id }} | ||||
|   SCRIPT_DIR:      ${{ github.workspace }}/asterisk-ci-actions/scripts | ||||
|   GH_TOKEN:        ${{ secrets.GITHUB_TOKEN }} | ||||
|   LOG_DIR:         ${{ github.workspace }}/logs | ||||
|   LOG_FILE:        ${{ github.workspace }}/logs/job_summary.txt | ||||
|   ACTIONS_OWNER:   asterisk | ||||
|   ACTIONS_REPO:    asterisk-ci-actions | ||||
|   ACTIONS_BRANCH:  main | ||||
|   TESTING_IN_PROGRESS: ${{ vars.CHERRY_PICK_TESTING_IN_PROGRESS }} | ||||
|   TESTS_PASSED:        ${{ vars.CHERRY_PICK_CHECKS_PASSED_LABEL }} | ||||
|   TESTS_FAILED:        ${{ vars.CHERRY_PICK_CHECKS_FAILED_LABEL }} | ||||
|  | ||||
| jobs: | ||||
|   Setup: | ||||
| @@ -17,58 +32,75 @@ jobs: | ||||
|     name: Setup | ||||
|     runs-on: ubuntu-latest | ||||
|     outputs: | ||||
|       branches:           ${{ steps.getbranches.outputs.branches }} | ||||
|       branch_count:       ${{ steps.getbranches.outputs.branch_count }} | ||||
|       testsuite_test_pr:  ${{ steps.testsuitepr.outputs.testsuite_test_pr }} | ||||
|       branches:           ${{ steps.setup.outputs.BRANCHES }} | ||||
|       branch_count:       ${{ steps.setup.outputs.BRANCH_COUNT }} | ||||
|       testsuite_test_pr:  ${{ steps.setup.outputs.TESTSUITE_TEST_PR }} | ||||
|     steps: | ||||
|       - name: Remove Trigger Label, Add InProgress Label | ||||
|       - id: setup | ||||
|         env: | ||||
|           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|           CHERRY_PICK_TEST_LABEL:          ${{ vars.CHERRY_PICK_TEST_LABEL }} | ||||
|           CHERRY_PICK_REGEX:               ${{ vars.CHERRY_PICK_REGEX }} | ||||
|           TESTSUITE_TEST_PR_REGEX:         ${{ vars.TESTSUITE_TEST_PR_REGEX }} | ||||
|         run: | | ||||
|           gh pr edit --repo ${{ github.repository }} \ | ||||
|             --remove-label ${{ vars.CHERRY_PICK_TEST_LABEL }} \ | ||||
|             --remove-label ${{ vars.CHERRY_PICK_CHECKS_PASSED_LABEL }} \ | ||||
|             --remove-label ${{ vars.CHERRY_PICK_CHECKS_FAILED_LABEL }} \ | ||||
|             --remove-label ${{ vars.CHERRY_PICK_TESTING_IN_PROGRESS }} \ | ||||
|             $PR_NUMBER || : | ||||
|           # Setup | ||||
|           wget -qO asterisk-ci-actions.tar.gz \ | ||||
|             https://github.com/${ACTIONS_OWNER}/${ACTIONS_REPO}/archive/refs/heads/${ACTIONS_BRANCH}.tar.gz | ||||
|           tar -xf asterisk-ci-actions.tar.gz --transform="s/^${ACTIONS_REPO}-${ACTIONS_BRANCH}/asterisk-ci-actions/g" | ||||
|  | ||||
|       - name: Get cherry-pick branches | ||||
|         uses: asterisk/asterisk-ci-actions/GetCherryPickBranchesFromPR@main | ||||
|         id: getbranches | ||||
|         with: | ||||
|           repo:                    ${{ github.repository }} | ||||
|           pr_number:               ${{ env.PR_NUMBER }} | ||||
|           cherry_pick_regex:       ${{ vars.CHERRY_PICK_REGEX }} | ||||
|           github_token:            ${{ secrets.GITHUB_TOKEN }} | ||||
|           gh pr edit --repo ${REPO} \ | ||||
|             --remove-label ${CHERRY_PICK_TEST_LABEL} \ | ||||
|             --remove-label ${TESTS_PASSED} \ | ||||
|             --remove-label ${TESTS_FAILED} \ | ||||
|             --remove-label ${TESTING_IN_PROGRESS} \ | ||||
|             ${PR_NUMBER} || : | ||||
|  | ||||
|       - name: Check Branch Count | ||||
|         if: ${{ steps.getbranches.outputs.branch_count > 0 }} | ||||
|           # The script will populate BRANCHES and BRANCH_COUNT in | ||||
|           # both GITHUB_ENV and GITHUB_OUTPUT for future use but | ||||
|           # we need them here as well so we need to capture and | ||||
|           # parse the output. | ||||
|           result=$(${SCRIPT_DIR}/getCherryPickBranchesFromPR.sh \ | ||||
|             --repo=${REPO} \ | ||||
|             --pr-number=${PR_NUMBER} \ | ||||
|             --cherry-pick-regex="${CHERRY_PICK_REGEX}") | ||||
|           BRANCH_COUNT=$(echo ${result} | jq -c '.branch_count') | ||||
|           BRANCHES=$(echo ${result} | jq -c '.branches') | ||||
|           FORCED_NONE=$(echo ${result} | jq -c '.forced_none') | ||||
|  | ||||
|           if [ ${BRANCH_COUNT} -eq 0 ] ; then | ||||
|             echo "No cherry-pick branches" | ||||
|             exit 0 | ||||
|           fi | ||||
|  | ||||
|           gh pr edit --repo ${REPO} \ | ||||
|             --add-label ${TESTING_IN_PROGRESS} \ | ||||
|             ${PR_NUMBER} || : | ||||
|  | ||||
|           # The script will populate TESTSUITE_TEST_PR in both | ||||
|           # GITHUB_ENV and GITHUB_OUTPUT. | ||||
|           ${SCRIPT_DIR}/getTestsuitePRfromAsteriskPR.sh \ | ||||
|             --repo=${REPO} \ | ||||
|             --pr-number=${PR_NUMBER} \ | ||||
|             --testsuite-pr-regex="${TESTSUITE_TEST_PR_REGEX}" | ||||
|  | ||||
|       - name: CheckCherryPicks | ||||
|         env: | ||||
|           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|           BRANCHES: ${{ steps.setup.outputs.branches }} | ||||
|         run: | | ||||
|           gh pr edit --repo ${{ github.repository }} \ | ||||
|           --add-label ${{ vars.CHERRY_PICK_TESTING_IN_PROGRESS }} \ | ||||
|           $PR_NUMBER || : | ||||
|           ${SCRIPT_DIR}/cherryPick.sh \ | ||||
|             --repo=${REPO} \ | ||||
|             --repo-dir=${REPO_DIR} \ | ||||
|             --pr-number=${PR_NUMBER} \ | ||||
|             --output-dir=${LOG_DIR} \ | ||||
|             --branches="${BRANCHES}" | ||||
|  | ||||
|       - name: GetTestsuitePR | ||||
|         id: testsuitepr | ||||
|         uses: asterisk/asterisk-ci-actions/GetTestsuitePRFromAsteriskPR@main | ||||
|       - name: Save Output | ||||
|         id: save-output | ||||
|         if: ${{ always() }} | ||||
|         uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           repo:                            ${{ github.repository }} | ||||
|           pr_number:                       ${{ github.event.number }} | ||||
|           testsuite_test_pr_regex:         ${{ vars.TESTSUITE_TEST_PR_REGEX }} | ||||
|           testsuite_test_auto_merge_regex: ${{ vars.TESTSUITE_TEST_AUTO_MERGE_REGEX }} | ||||
|           github_token:                    ${{ secrets.GITHUB_TOKEN }} | ||||
|  | ||||
|       - name: CherryPick | ||||
|         uses: asterisk/asterisk-ci-actions/CherryPick@main | ||||
|         with: | ||||
|           repo:         ${{ github.repository }} | ||||
|           pr_number:    ${{ github.event.number }} | ||||
|           branches:     ${{ steps.getbranches.outputs.branches }} | ||||
|           push:         false | ||||
|           github_token: ${{ secrets.GITHUB_TOKEN }} | ||||
|           debug:        false | ||||
|           name: Setup | ||||
|           if-no-files-found: ignore | ||||
|           path: ${{ env.LOG_DIR }} | ||||
|  | ||||
|   Check: | ||||
|     needs: [Setup] | ||||
| @@ -93,32 +125,61 @@ jobs: | ||||
|     secrets: | ||||
|       TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|  | ||||
|   Cleanup: | ||||
|     if: ${{ success() || failure() }} | ||||
|   PostWorkflow: | ||||
|     if: ${{ success() || failure() || cancelled() }} | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: [Setup,Check] | ||||
|     env: | ||||
|       RESULT:              ${{ needs.Check.result }} | ||||
|       BUILD_CACHE_KEY_PREFIX:  ${{ github.workflow }}-${{ github.run_number }}-${{ github.event.number }} | ||||
|       BRANCHES: ${{ needs.Setup.outputs.branches }} | ||||
|     steps: | ||||
|       - name: Check status | ||||
|         env: | ||||
|           GH_TOKEN:     ${{ secrets.GITHUB_TOKEN }} | ||||
|           RESULT_UNIT:  ${{ needs.Check.result }} | ||||
|           TESTS_PASSED: ${{ vars.CHERRY_PICK_CHECKS_PASSED_LABEL }} | ||||
|           TESTS_FAILED: ${{ vars.CHERRY_PICK_CHECKS_FAILED_LABEL }} | ||||
|         run: | | ||||
|           declare -i rc=0 | ||||
|           case $RESULT_UNIT in | ||||
|           label="" | ||||
|           branches=$(echo $BRANCHES | jq -r '.[]') | ||||
|           case $RESULT in | ||||
|             success) | ||||
|               label=$TESTS_PASSED | ||||
|               for b in $branches ; do | ||||
|                 gh cache delete -R ${REPO} ${BUILD_CACHE_KEY_PREFIX}-$b || : | ||||
|               done | ||||
|               ;; | ||||
|             failure) | ||||
|               label=$TESTS_FAILED | ||||
|               ;; | ||||
|             cancelled) | ||||
|               for b in $branches ; do | ||||
|                 gh cache delete -R ${REPO} ${BUILD_CACHE_KEY_PREFIX}-$b || : | ||||
|               done | ||||
|               ;; | ||||
|             skipped) | ||||
|               rc+=1 | ||||
|               ;; | ||||
|             *) | ||||
|               rc+=1 | ||||
|               ;; | ||||
|           esac | ||||
|           [ $rc -gt 0 ] && label=$TESTS_FAILED || label=$TESTS_PASSED | ||||
|           gh pr edit --repo ${{ github.repository }} \ | ||||
|             --remove-label ${{ vars.CHERRY_PICK_TESTING_IN_PROGRESS }} \ | ||||
|             --add-label $label \ | ||||
|           gh pr edit --repo ${REPO} \ | ||||
|             --remove-label ${TESTING_IN_PROGRESS} \ | ||||
|             ${label:+--add-label $label} \ | ||||
|               $PR_NUMBER || : | ||||
|           exit 0 | ||||
|  | ||||
|       - name: Create Job Summary | ||||
|         if: ${{ success() || failure() }} | ||||
|         run: | | ||||
|           wget -qO asterisk-ci-actions.tar.gz \ | ||||
|             https://github.com/${ACTIONS_OWNER}/${ACTIONS_REPO}/archive/refs/heads/${ACTIONS_BRANCH}.tar.gz | ||||
|           tar -xf asterisk-ci-actions.tar.gz --transform="s/^${ACTIONS_REPO}-${ACTIONS_BRANCH}/asterisk-ci-actions/g" | ||||
|  | ||||
|           ${SCRIPT_DIR}/createJobSummary.sh \ | ||||
|             --result=${RESULT} \ | ||||
|             --repo=${REPO} \ | ||||
|             --workflow-name="${WORKFLOW_NAME}" \ | ||||
|             --pr-number=${PR_NUMBER} \ | ||||
|             --workflow-run=${WORKFLOW_RUN_ID} \ | ||||
|             --tmp-dir=./run-${WORKFLOW_RUN_ID} \ | ||||
|             --job-summary-output=job_summary.txt \ | ||||
|             --write-step-summary \ | ||||
|             --add-pr-comment \ | ||||
|             --verbose || : | ||||
|           exit 0 | ||||
|   | ||||
							
								
								
									
										128
									
								
								.github/workflows/OnPRRecheck.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										128
									
								
								.github/workflows/OnPRRecheck.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,48 +1,70 @@ | ||||
| name: PRReCheck | ||||
| run-name: "PR ${{ github.event.number }} Recheck" | ||||
| run-name: "PR ${{ github.event.number }} Recheck by ${{ github.actor }}" | ||||
| on: | ||||
|   pull_request_target: | ||||
|     types: [ labeled ] | ||||
|  | ||||
| concurrency: | ||||
|   group: check-${{ github.event.number }} | ||||
|   group: recheck-${{ github.event.number }} | ||||
|   cancel-in-progress: true | ||||
|  | ||||
| env: | ||||
|   PR_NUMBER: ${{ github.event.number }} | ||||
|   REPO:            ${{ github.repository }} | ||||
|   REPO_DIR:        ${{ github.workspace }}/${{ github.event.repository.name }} | ||||
|   REPO_ORG:        ${{ github.event.repository.owner.login }} | ||||
|   PR_NUMBER:       ${{ github.event.number }} | ||||
|   BASE_BRANCH:     ${{ github.event.pull_request.base.ref }} | ||||
|   WORKFLOW_NAME:   ${{ github.workflow }} | ||||
|   WORKFLOW_RUN_ID: ${{ github.run_id }} | ||||
|   SCRIPT_DIR:      ${{ github.workspace }}/asterisk-ci-actions/scripts | ||||
|   GH_TOKEN:        ${{ secrets.GITHUB_TOKEN }} | ||||
|   LOG_DIR:         ${{ github.workspace }}/logs | ||||
|   ACTIONS_OWNER:   asterisk | ||||
|   ACTIONS_REPO:    asterisk-ci-actions | ||||
|   ACTIONS_BRANCH:  main | ||||
|   TESTING_IN_PROGRESS: ${{ vars.PR_SUBMIT_TESTING_IN_PROGRESS }} | ||||
|   TESTS_PASSED:        ${{ vars.PR_SUBMIT_TESTS_PASSED }} | ||||
|   TESTS_FAILED:        ${{ vars.PR_SUBMIT_TESTS_FAILED }} | ||||
|  | ||||
| jobs: | ||||
|   Setup: | ||||
|     if: ${{ github.event.label.name == vars.RECHECKPR_LABEL }} | ||||
|     runs-on: ubuntu-latest | ||||
|     outputs: | ||||
|       testsuite_test_pr:  ${{ steps.testsuitepr.outputs.testsuite_test_pr }} | ||||
|       testsuite_test_pr: ${{ steps.setup.outputs.TESTSUITE_TEST_PR }} | ||||
|       normalized_branch: ${{ steps.setup.outputs.NORMALIZED_BRANCH }} | ||||
|     steps: | ||||
|       - name: Set Label | ||||
|         id: setlabel | ||||
|       - id: setup | ||||
|         env: | ||||
|           GH_TOKEN:  ${{ secrets.GITHUB_TOKEN }} | ||||
|           RECHECKPR_LABEL:    ${{ vars.RECHECKPR_LABEL }} | ||||
|           TESTSUITE_TEST_PR_REGEX: ${{ vars.TESTSUITE_TEST_PR_REGEX }} | ||||
|         run: | | ||||
|           gh pr edit --repo ${{ github.repository }} \ | ||||
|             --remove-label ${{ vars.RECHECKPR_LABEL }} \ | ||||
|             --remove-label ${{ vars.PR_SUBMIT_TESTS_PASSED }} \ | ||||
|             --remove-label  ${{ vars.PR_SUBMIT_TESTS_FAILED }} \ | ||||
|             --add-label ${{ vars.PR_SUBMIT_TESTING_IN_PROGRESS }} \ | ||||
|             $PR_NUMBER || : | ||||
|           # GetScripts | ||||
|           NORMALIZED_BRANCH="${BASE_BRANCH/\//-}" | ||||
|           echo "NORMALIZED_BRANCH=${NORMALIZED_BRANCH}" >> ${GITHUB_ENV} | ||||
|           echo "NORMALIZED_BRANCH=${NORMALIZED_BRANCH}" >> ${GITHUB_OUTPUT} | ||||
|  | ||||
|       - name: GetTestsuitePR | ||||
|         id: testsuitepr | ||||
|         uses: asterisk/asterisk-ci-actions/GetTestsuitePRFromAsteriskPR@main | ||||
|         with: | ||||
|           repo:                            ${{ github.repository }} | ||||
|           pr_number:                       ${{ github.event.number }} | ||||
|           testsuite_test_pr_regex:         ${{ vars.TESTSUITE_TEST_PR_REGEX }} | ||||
|           testsuite_test_auto_merge_regex: ${{ vars.TESTSUITE_TEST_AUTO_MERGE_REGEX }} | ||||
|           github_token:                    ${{ secrets.GITHUB_TOKEN }} | ||||
|           wget -qO asterisk-ci-actions.tar.gz \ | ||||
|             https://github.com/${ACTIONS_OWNER}/${ACTIONS_REPO}/archive/refs/heads/${ACTIONS_BRANCH}.tar.gz | ||||
|           tar -xf asterisk-ci-actions.tar.gz --transform="s/^${ACTIONS_REPO}-${ACTIONS_BRANCH}/asterisk-ci-actions/g" | ||||
|  | ||||
|   ReCheck: | ||||
|     name: ReCheck | ||||
|     needs: Setup | ||||
|           gh pr edit --repo ${REPO} \ | ||||
|             --remove-label ${RECHECKPR_LABEL} \ | ||||
|             --remove-label ${TESTS_PASSED} \ | ||||
|             --remove-label ${TESTS_FAILED} \ | ||||
|             --add-label ${TESTING_IN_PROGRESS} \ | ||||
|             ${PR_NUMBER} || : | ||||
|  | ||||
|           # Testsuite PR will be placed in TESTSUITE_TEST_PR in both | ||||
|           # GITHUB_ENV and GITHUB_OUTPUT by the script. | ||||
|           ${SCRIPT_DIR}/getTestsuitePRfromAsteriskPR.sh \ | ||||
|             --repo=${REPO} \ | ||||
|             --pr-number=${PR_NUMBER} \ | ||||
|             --testsuite-pr-regex="${TESTSUITE_TEST_PR_REGEX}" | ||||
|  | ||||
|   Check: | ||||
|     name: Check | ||||
|     needs: [ Setup ] | ||||
|     uses: asterisk/asterisk-ci-actions/.github/workflows/AsteriskUnitGateTest.yml@main | ||||
|     with: | ||||
|       test_type:         prrecheck | ||||
| @@ -59,31 +81,55 @@ jobs: | ||||
|     secrets: | ||||
|       TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|  | ||||
|   Cleanup: | ||||
|     if: ${{ success() || failure() }} | ||||
|   PostWorkflow: | ||||
|     if: ${{ success() || failure() || cancelled() }} | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: [Setup,ReCheck] | ||||
|     needs: [Setup,Check] | ||||
|     env: | ||||
|       RESULT:              ${{ needs.Check.result }} | ||||
|       BUILD_CACHE_KEY:     ${{ github.workflow }}-${{ github.run_number }}-${{ github.event.number }}-${{ github.event.pull_request.base.ref }} | ||||
|     steps: | ||||
|       - name: Check status | ||||
|         env: | ||||
|           GH_TOKEN:  ${{ secrets.GITHUB_TOKEN }} | ||||
|           RESULT_UNIT: ${{ needs.ReCheck.result }} | ||||
|           TESTS_PASSED: ${{ vars.PR_SUBMIT_TESTS_PASSED }} | ||||
|           TESTS_FAILED: ${{ vars.PR_SUBMIT_TESTS_FAILED }} | ||||
|         run: | | ||||
|           declare -i rc=0 | ||||
|           case $RESULT_UNIT in | ||||
|           label="" | ||||
|           case $RESULT in | ||||
|             success) | ||||
|               label=$TESTS_PASSED | ||||
|               gh cache delete -R ${REPO} ${BUILD_CACHE_KEY} || : | ||||
|               ;; | ||||
|             failure) | ||||
|               label=$TESTS_FAILED | ||||
|               ;; | ||||
|             cancelled) | ||||
|               gh cache delete -R ${REPO} ${BUILD_CACHE_KEY} || : | ||||
|               ;; | ||||
|             skipped) | ||||
|               rc+=1 | ||||
|               ;; | ||||
|             *) | ||||
|               rc+=1 | ||||
|               ;; | ||||
|           esac | ||||
|           [ $rc -gt 0 ] && label=$TESTS_FAILED || label=$TESTS_PASSED | ||||
|           gh pr edit --repo ${{ github.repository }} \ | ||||
|             --remove-label ${{ vars.PR_SUBMIT_TESTING_IN_PROGRESS }} \ | ||||
|             --add-label $label \ | ||||
|           gh pr edit --repo ${REPO} \ | ||||
|             --remove-label ${TESTING_IN_PROGRESS} \ | ||||
|             ${label:+--add-label $label} \ | ||||
|               $PR_NUMBER || : | ||||
|           exit 0 | ||||
|  | ||||
|       - name: Create Job Summary | ||||
|         if: ${{ success() || failure() }} | ||||
|         run: | | ||||
|           wget -qO asterisk-ci-actions.tar.gz \ | ||||
|             https://github.com/${ACTIONS_OWNER}/${ACTIONS_REPO}/archive/refs/heads/${ACTIONS_BRANCH}.tar.gz | ||||
|           tar -xf asterisk-ci-actions.tar.gz --transform="s/^${ACTIONS_REPO}-${ACTIONS_BRANCH}/asterisk-ci-actions/g" | ||||
|  | ||||
|           ${SCRIPT_DIR}/createJobSummary.sh \ | ||||
|             --result=${RESULT} \ | ||||
|             --repo=${REPO} \ | ||||
|             --workflow-name="${WORKFLOW_NAME}" \ | ||||
|             --pr-number=${PR_NUMBER} \ | ||||
|             --workflow-run=${WORKFLOW_RUN_ID} \ | ||||
|             --tmp-dir=./run-${WORKFLOW_RUN_ID} \ | ||||
|             --job-summary-output=job_summary.txt \ | ||||
|             --write-step-summary \ | ||||
|             --add-pr-comment \ | ||||
|             --verbose || : | ||||
|           exit 0 | ||||
|   | ||||
							
								
								
									
										74
									
								
								.github/workflows/OnPRStateChanged.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										74
									
								
								.github/workflows/OnPRStateChanged.yml
									
									
									
									
										vendored
									
									
								
							| @@ -23,6 +23,21 @@ concurrency: | ||||
|   group: check-${{ github.event.number }} | ||||
|   cancel-in-progress: true | ||||
|  | ||||
| env: | ||||
|   REPO:            ${{ github.repository }} | ||||
|   REPO_DIR:        ${{ github.workspace }}/${{ github.event.repository.name }} | ||||
|   REPO_ORG:        ${{ github.event.repository.owner.login }} | ||||
|   PR_NUMBER:       ${{ github.event.number }} | ||||
|   BASE_BRANCH:     ${{ github.event.pull_request.base.ref }} | ||||
|   WORKFLOW_NAME:   ${{ github.workflow }} | ||||
|   WORKFLOW_RUN_ID: ${{ github.run_id }} | ||||
|   SCRIPT_DIR:      ${{ github.workspace }}/asterisk-ci-actions/scripts | ||||
|   GH_TOKEN:        ${{ secrets.GITHUB_TOKEN }} | ||||
|   LOG_DIR:         ${{ github.workspace }}/logs | ||||
|   ACTIONS_OWNER:   asterisk | ||||
|   ACTIONS_REPO:    asterisk-ci-actions | ||||
|   ACTIONS_BRANCH:  main | ||||
|  | ||||
| jobs: | ||||
| # | ||||
| # Pull requests created from forked respositories don't have access | ||||
| @@ -33,37 +48,37 @@ jobs: | ||||
|     runs-on: ubuntu-latest | ||||
|     outputs: | ||||
|       vars:  ${{ steps.setvars.outputs.control_data }} | ||||
|       testsuite_test_pr:  ${{ steps.testsuitepr.outputs.testsuite_test_pr }} | ||||
|       testsuite_test_pr: ${{ steps.setup.outputs.TESTSUITE_TEST_PR }} | ||||
|       normalized_branch: ${{ steps.setup.outputs.NORMALIZED_BRANCH }} | ||||
|     steps: | ||||
|       - id: setvars | ||||
|         uses: asterisk/asterisk-ci-actions/GetRepoControlData@main | ||||
|         with: | ||||
|           repo: ${{ github.event.repository.name }} | ||||
|  | ||||
|       - id: wait | ||||
|       - id: setup | ||||
|         env: | ||||
|           PR_STATE_CHANGE_DELAY_SEC: ${{ fromJSON(steps.setvars.outputs.control_data).PR_STATE_CHANGE_DELAY_SEC || 120 }} | ||||
|           TESTSUITE_TEST_PR_REGEX: ${{ fromJSON(steps.setvars.outputs.control_data).TESTSUITE_TEST_PR_REGEX }} | ||||
|         run: | | ||||
|           # Wait then get testsuite PR | ||||
|           echo "Waiting for ${PR_STATE_CHANGE_DELAY_SEC} seconds to give user a chance to add PR comments" | ||||
|           sleep ${PR_STATE_CHANGE_DELAY_SEC} | ||||
|           exit 0 | ||||
|  | ||||
|       - name: GetTestsuitePR | ||||
|         id: testsuitepr | ||||
|         uses: asterisk/asterisk-ci-actions/GetTestsuitePRFromAsteriskPR@main | ||||
|         with: | ||||
|           repo:                            ${{ github.repository }} | ||||
|           pr_number:                       ${{ github.event.number }} | ||||
|           testsuite_test_pr_regex:         ${{ fromJSON(steps.setvars.outputs.control_data).TESTSUITE_TEST_PR_REGEX }} | ||||
|           testsuite_test_auto_merge_regex: ${{ fromJSON(steps.setvars.outputs.control_data).TESTSUITE_TEST_AUTO_MERGE_REGEX }} | ||||
|           github_token:                    ${{ secrets.GITHUB_TOKEN }} | ||||
|           NORMALIZED_BRANCH="${BASE_BRANCH/\//-}" | ||||
|           echo "NORMALIZED_BRANCH=${NORMALIZED_BRANCH}" >> ${GITHUB_ENV} | ||||
|           echo "NORMALIZED_BRANCH=${NORMALIZED_BRANCH}" >> ${GITHUB_OUTPUT} | ||||
|  | ||||
|       - name: DumpEnvironment | ||||
|         if: ${{ fromJSON(steps.setvars.outputs.control_data).RUN_DUMP_ENV }} | ||||
|         uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main | ||||
|         with: | ||||
|           action-vars: ${{ toJSON(steps.setvars.outputs) }} | ||||
|           action-inputs: ${{ toJSON(steps.testsuitepr.outputs) }} | ||||
|           wget -qO asterisk-ci-actions.tar.gz \ | ||||
|             https://github.com/${ACTIONS_OWNER}/${ACTIONS_REPO}/archive/refs/heads/${ACTIONS_BRANCH}.tar.gz | ||||
|           tar -xf asterisk-ci-actions.tar.gz --transform="s/^${ACTIONS_REPO}-${ACTIONS_BRANCH}/asterisk-ci-actions/g" | ||||
|  | ||||
|           # Testsuite PR will be placed in TESTSUITE_TEST_PR in both | ||||
|           # GITHUB_ENV and GITHUB_OUTPUT by the script. | ||||
|           ${SCRIPT_DIR}/getTestsuitePRfromAsteriskPR.sh \ | ||||
|             --repo=${REPO} \ | ||||
|             --pr-number=${PR_NUMBER} \ | ||||
|             --testsuite-pr-regex="${TESTSUITE_TEST_PR_REGEX}" | ||||
|  | ||||
|   Check: | ||||
|     name: Check | ||||
| @@ -83,3 +98,26 @@ jobs: | ||||
|     secrets: | ||||
|       TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|  | ||||
|   PostWorkflow: | ||||
|     if: ${{ success() || failure() }} | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: [Setup,Check] | ||||
|     env: | ||||
|       RESULT:  ${{ needs.Check.result }} | ||||
|     steps: | ||||
|       - name: Create Job Summary | ||||
|         run: | | ||||
|           wget -qO asterisk-ci-actions.tar.gz \ | ||||
|             https://github.com/${ACTIONS_OWNER}/${ACTIONS_REPO}/archive/refs/heads/${ACTIONS_BRANCH}.tar.gz | ||||
|           tar -xf asterisk-ci-actions.tar.gz --transform="s/^${ACTIONS_REPO}-${ACTIONS_BRANCH}/asterisk-ci-actions/g" | ||||
|  | ||||
|           ${SCRIPT_DIR}/createJobSummary.sh \ | ||||
|             --result=${RESULT} \ | ||||
|             --repo=${REPO} \ | ||||
|             --workflow-name="${WORKFLOW_NAME}" \ | ||||
|             --workflow-run=${WORKFLOW_RUN_ID} \ | ||||
|             --tmp-dir=./run-${WORKFLOW_RUN_ID} \ | ||||
|             --job-summary-output=job_summary.txt \ | ||||
|             --write-step-summary \ | ||||
|             --verbose || : | ||||
|           exit 0 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user