mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
.github: OnPRCherryPickTest,OnPRStateChanged,OnPRRecheck: Add job summaries.
...and refactor environment variables.
This commit is contained in:
183
.github/workflows/OnPRCherryPickTest.yml
vendored
183
.github/workflows/OnPRCherryPickTest.yml
vendored
@@ -1,15 +1,30 @@
|
|||||||
name: PRCPCheck
|
name: PRCPCheck
|
||||||
run-name: "PR ${{ github.event.number }} CherryPickTest"
|
run-name: "PR ${{ github.event.number }} CherryPickTest by ${{ github.actor }}"
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [ labeled ]
|
types: [ labeled ]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.label.name }}-${{ github.event.number }}
|
group: ${{ github.event.label.name }}-${{ github.event.number }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
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:
|
jobs:
|
||||||
Setup:
|
Setup:
|
||||||
@@ -17,58 +32,75 @@ jobs:
|
|||||||
name: Setup
|
name: Setup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
branches: ${{ steps.getbranches.outputs.branches }}
|
branches: ${{ steps.setup.outputs.BRANCHES }}
|
||||||
branch_count: ${{ steps.getbranches.outputs.branch_count }}
|
branch_count: ${{ steps.setup.outputs.BRANCH_COUNT }}
|
||||||
testsuite_test_pr: ${{ steps.testsuitepr.outputs.testsuite_test_pr }}
|
testsuite_test_pr: ${{ steps.setup.outputs.TESTSUITE_TEST_PR }}
|
||||||
steps:
|
steps:
|
||||||
- name: Remove Trigger Label, Add InProgress Label
|
- id: setup
|
||||||
env:
|
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: |
|
run: |
|
||||||
gh pr edit --repo ${{ github.repository }} \
|
# Setup
|
||||||
--remove-label ${{ vars.CHERRY_PICK_TEST_LABEL }} \
|
wget -qO asterisk-ci-actions.tar.gz \
|
||||||
--remove-label ${{ vars.CHERRY_PICK_CHECKS_PASSED_LABEL }} \
|
https://github.com/${ACTIONS_OWNER}/${ACTIONS_REPO}/archive/refs/heads/${ACTIONS_BRANCH}.tar.gz
|
||||||
--remove-label ${{ vars.CHERRY_PICK_CHECKS_FAILED_LABEL }} \
|
tar -xf asterisk-ci-actions.tar.gz --transform="s/^${ACTIONS_REPO}-${ACTIONS_BRANCH}/asterisk-ci-actions/g"
|
||||||
--remove-label ${{ vars.CHERRY_PICK_TESTING_IN_PROGRESS }} \
|
|
||||||
$PR_NUMBER || :
|
|
||||||
|
|
||||||
- name: Get cherry-pick branches
|
gh pr edit --repo ${REPO} \
|
||||||
uses: asterisk/asterisk-ci-actions/GetCherryPickBranchesFromPR@main
|
--remove-label ${CHERRY_PICK_TEST_LABEL} \
|
||||||
id: getbranches
|
--remove-label ${TESTS_PASSED} \
|
||||||
with:
|
--remove-label ${TESTS_FAILED} \
|
||||||
repo: ${{ github.repository }}
|
--remove-label ${TESTING_IN_PROGRESS} \
|
||||||
pr_number: ${{ env.PR_NUMBER }}
|
${PR_NUMBER} || :
|
||||||
cherry_pick_regex: ${{ vars.CHERRY_PICK_REGEX }}
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Check Branch Count
|
# The script will populate BRANCHES and BRANCH_COUNT in
|
||||||
if: ${{ steps.getbranches.outputs.branch_count > 0 }}
|
# 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:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
BRANCHES: ${{ steps.setup.outputs.branches }}
|
||||||
run: |
|
run: |
|
||||||
gh pr edit --repo ${{ github.repository }} \
|
${SCRIPT_DIR}/cherryPick.sh \
|
||||||
--add-label ${{ vars.CHERRY_PICK_TESTING_IN_PROGRESS }} \
|
--repo=${REPO} \
|
||||||
$PR_NUMBER || :
|
--repo-dir=${REPO_DIR} \
|
||||||
|
--pr-number=${PR_NUMBER} \
|
||||||
|
--output-dir=${LOG_DIR} \
|
||||||
|
--branches="${BRANCHES}"
|
||||||
|
|
||||||
- name: GetTestsuitePR
|
- name: Save Output
|
||||||
id: testsuitepr
|
id: save-output
|
||||||
uses: asterisk/asterisk-ci-actions/GetTestsuitePRFromAsteriskPR@main
|
if: ${{ always() }}
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
repo: ${{ github.repository }}
|
name: Setup
|
||||||
pr_number: ${{ github.event.number }}
|
if-no-files-found: ignore
|
||||||
testsuite_test_pr_regex: ${{ vars.TESTSUITE_TEST_PR_REGEX }}
|
path: ${{ env.LOG_DIR }}
|
||||||
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
|
|
||||||
|
|
||||||
Check:
|
Check:
|
||||||
needs: [Setup]
|
needs: [Setup]
|
||||||
@@ -93,32 +125,61 @@ jobs:
|
|||||||
secrets:
|
secrets:
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
Cleanup:
|
PostWorkflow:
|
||||||
if: ${{ success() || failure() }}
|
if: ${{ success() || failure() || cancelled() }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [Setup,Check]
|
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:
|
steps:
|
||||||
- name: Check status
|
- 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: |
|
run: |
|
||||||
declare -i rc=0
|
label=""
|
||||||
case $RESULT_UNIT in
|
branches=$(echo $BRANCHES | jq -r '.[]')
|
||||||
|
case $RESULT in
|
||||||
success)
|
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)
|
skipped)
|
||||||
rc+=1
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
rc+=1
|
;;
|
||||||
esac
|
esac
|
||||||
[ $rc -gt 0 ] && label=$TESTS_FAILED || label=$TESTS_PASSED
|
gh pr edit --repo ${REPO} \
|
||||||
gh pr edit --repo ${{ github.repository }} \
|
--remove-label ${TESTING_IN_PROGRESS} \
|
||||||
--remove-label ${{ vars.CHERRY_PICK_TESTING_IN_PROGRESS }} \
|
${label:+--add-label $label} \
|
||||||
--add-label $label \
|
|
||||||
$PR_NUMBER || :
|
$PR_NUMBER || :
|
||||||
exit 0
|
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
|
name: PRReCheck
|
||||||
run-name: "PR ${{ github.event.number }} Recheck"
|
run-name: "PR ${{ github.event.number }} Recheck by ${{ github.actor }}"
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [ labeled ]
|
types: [ labeled ]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: check-${{ github.event.number }}
|
group: recheck-${{ github.event.number }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
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:
|
jobs:
|
||||||
Setup:
|
Setup:
|
||||||
if: ${{ github.event.label.name == vars.RECHECKPR_LABEL }}
|
if: ${{ github.event.label.name == vars.RECHECKPR_LABEL }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
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:
|
steps:
|
||||||
- name: Set Label
|
- id: setup
|
||||||
id: setlabel
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
RECHECKPR_LABEL: ${{ vars.RECHECKPR_LABEL }}
|
||||||
|
TESTSUITE_TEST_PR_REGEX: ${{ vars.TESTSUITE_TEST_PR_REGEX }}
|
||||||
run: |
|
run: |
|
||||||
gh pr edit --repo ${{ github.repository }} \
|
# GetScripts
|
||||||
--remove-label ${{ vars.RECHECKPR_LABEL }} \
|
NORMALIZED_BRANCH="${BASE_BRANCH/\//-}"
|
||||||
--remove-label ${{ vars.PR_SUBMIT_TESTS_PASSED }} \
|
echo "NORMALIZED_BRANCH=${NORMALIZED_BRANCH}" >> ${GITHUB_ENV}
|
||||||
--remove-label ${{ vars.PR_SUBMIT_TESTS_FAILED }} \
|
echo "NORMALIZED_BRANCH=${NORMALIZED_BRANCH}" >> ${GITHUB_OUTPUT}
|
||||||
--add-label ${{ vars.PR_SUBMIT_TESTING_IN_PROGRESS }} \
|
|
||||||
$PR_NUMBER || :
|
|
||||||
|
|
||||||
- name: GetTestsuitePR
|
wget -qO asterisk-ci-actions.tar.gz \
|
||||||
id: testsuitepr
|
https://github.com/${ACTIONS_OWNER}/${ACTIONS_REPO}/archive/refs/heads/${ACTIONS_BRANCH}.tar.gz
|
||||||
uses: asterisk/asterisk-ci-actions/GetTestsuitePRFromAsteriskPR@main
|
tar -xf asterisk-ci-actions.tar.gz --transform="s/^${ACTIONS_REPO}-${ACTIONS_BRANCH}/asterisk-ci-actions/g"
|
||||||
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 }}
|
|
||||||
|
|
||||||
ReCheck:
|
gh pr edit --repo ${REPO} \
|
||||||
name: ReCheck
|
--remove-label ${RECHECKPR_LABEL} \
|
||||||
needs: Setup
|
--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
|
uses: asterisk/asterisk-ci-actions/.github/workflows/AsteriskUnitGateTest.yml@main
|
||||||
with:
|
with:
|
||||||
test_type: prrecheck
|
test_type: prrecheck
|
||||||
@@ -59,31 +81,55 @@ jobs:
|
|||||||
secrets:
|
secrets:
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
Cleanup:
|
PostWorkflow:
|
||||||
if: ${{ success() || failure() }}
|
if: ${{ success() || failure() || cancelled() }}
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- name: Check status
|
- 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: |
|
run: |
|
||||||
declare -i rc=0
|
label=""
|
||||||
case $RESULT_UNIT in
|
case $RESULT in
|
||||||
success)
|
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)
|
skipped)
|
||||||
rc+=1
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
rc+=1
|
;;
|
||||||
esac
|
esac
|
||||||
[ $rc -gt 0 ] && label=$TESTS_FAILED || label=$TESTS_PASSED
|
gh pr edit --repo ${REPO} \
|
||||||
gh pr edit --repo ${{ github.repository }} \
|
--remove-label ${TESTING_IN_PROGRESS} \
|
||||||
--remove-label ${{ vars.PR_SUBMIT_TESTING_IN_PROGRESS }} \
|
${label:+--add-label $label} \
|
||||||
--add-label $label \
|
|
||||||
$PR_NUMBER || :
|
$PR_NUMBER || :
|
||||||
exit 0
|
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 }}
|
group: check-${{ github.event.number }}
|
||||||
cancel-in-progress: true
|
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:
|
jobs:
|
||||||
#
|
#
|
||||||
# Pull requests created from forked respositories don't have access
|
# Pull requests created from forked respositories don't have access
|
||||||
@@ -33,37 +48,37 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
vars: ${{ steps.setvars.outputs.control_data }}
|
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:
|
steps:
|
||||||
- id: setvars
|
- id: setvars
|
||||||
uses: asterisk/asterisk-ci-actions/GetRepoControlData@main
|
uses: asterisk/asterisk-ci-actions/GetRepoControlData@main
|
||||||
with:
|
with:
|
||||||
repo: ${{ github.event.repository.name }}
|
repo: ${{ github.event.repository.name }}
|
||||||
|
|
||||||
- id: wait
|
- id: setup
|
||||||
env:
|
env:
|
||||||
PR_STATE_CHANGE_DELAY_SEC: ${{ fromJSON(steps.setvars.outputs.control_data).PR_STATE_CHANGE_DELAY_SEC || 120 }}
|
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: |
|
run: |
|
||||||
|
# Wait then get testsuite PR
|
||||||
echo "Waiting for ${PR_STATE_CHANGE_DELAY_SEC} seconds to give user a chance to add PR comments"
|
echo "Waiting for ${PR_STATE_CHANGE_DELAY_SEC} seconds to give user a chance to add PR comments"
|
||||||
sleep ${PR_STATE_CHANGE_DELAY_SEC}
|
sleep ${PR_STATE_CHANGE_DELAY_SEC}
|
||||||
exit 0
|
|
||||||
|
|
||||||
- name: GetTestsuitePR
|
NORMALIZED_BRANCH="${BASE_BRANCH/\//-}"
|
||||||
id: testsuitepr
|
echo "NORMALIZED_BRANCH=${NORMALIZED_BRANCH}" >> ${GITHUB_ENV}
|
||||||
uses: asterisk/asterisk-ci-actions/GetTestsuitePRFromAsteriskPR@main
|
echo "NORMALIZED_BRANCH=${NORMALIZED_BRANCH}" >> ${GITHUB_OUTPUT}
|
||||||
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 }}
|
|
||||||
|
|
||||||
- name: DumpEnvironment
|
wget -qO asterisk-ci-actions.tar.gz \
|
||||||
if: ${{ fromJSON(steps.setvars.outputs.control_data).RUN_DUMP_ENV }}
|
https://github.com/${ACTIONS_OWNER}/${ACTIONS_REPO}/archive/refs/heads/${ACTIONS_BRANCH}.tar.gz
|
||||||
uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main
|
tar -xf asterisk-ci-actions.tar.gz --transform="s/^${ACTIONS_REPO}-${ACTIONS_BRANCH}/asterisk-ci-actions/g"
|
||||||
with:
|
|
||||||
action-vars: ${{ toJSON(steps.setvars.outputs) }}
|
# Testsuite PR will be placed in TESTSUITE_TEST_PR in both
|
||||||
action-inputs: ${{ toJSON(steps.testsuitepr.outputs) }}
|
# 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:
|
Check:
|
||||||
name: Check
|
name: Check
|
||||||
@@ -83,3 +98,26 @@ jobs:
|
|||||||
secrets:
|
secrets:
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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