From 77b5fde42245252038de407ed22b5cab1e96175c Mon Sep 17 00:00:00 2001 From: pyth0n1c <87383215+pyth0n1c@users.noreply.github.com> Date: Thu, 13 Jan 2022 10:22:25 -0800 Subject: [PATCH 1/4] Fixed scheduled action for nightly test. Now, it will hopefully only run the test of the entire repo on the SCHEDULED github.event.action, not on scheduled event of any commit to the develop branch. We have changed the schedule interval to hourly for testing purposes today and will change it back to nightly after today's testing. --- .github/workflows/detection-testing.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/detection-testing.yml b/.github/workflows/detection-testing.yml index 094ac48098..3e08506122 100644 --- a/.github/workflows/detection-testing.yml +++ b/.github/workflows/detection-testing.yml @@ -4,7 +4,7 @@ on: pull_request: types: [opened, reopened] schedule: - - cron: "44 4 * * *" + - cron: "44 * * * *" jobs: validate-tag-if-present: @@ -74,12 +74,13 @@ jobs: echo "github.event.pull_request.number : [${{ github.event.pull_request.number }}]" echo "steps.vars.outputs.branch : [${{ steps.vars.outputs.branch }}]" echo "github.event.pull_request.head.ref : [${{ github.event.pull_request.head.ref }}]" - + echo "The trigger (github.event.action) : [${{github.event.action}}]" - if [[ ${{ steps.vars.outputs.branch }} == develop ]]; then - echo "Running a nightly test on all detections" - python detection_testing_execution.py run --branch ${{ github.event.pull_request.head.ref }} --mode all --mock --config_file test_config_github_actions.json + if [[ ${{github.event.action}} == schedule ]]; then + # Note that scheduled actions ONLY run on the default branch, so it won't run on all other branches! + echo "Running a nightly test on all detections OR a commit was made directly to develop" + python detection_testing_execution.py run --branch develop --mode all --mock --config_file test_config_github_actions.json elif [[ ! -z "${{ github.event.pull_request.head.ref }}" && ! -z "${{ github.event.pull_request.number }}" ]]; then echo "Pull request from source branch [${{ github.event.pull_request.head.ref }}] for PR number [${{ github.event.issue.number }}]" python detection_testing_execution.py run --branch ${{ github.event.pull_request.head.ref }} --pr_number ${{ github.event.pull_request.number }} --mode changes --mock --config_file test_config_github_actions.json From da5e00e5807cb9de20e02bf8f04c9ca4d85d699f Mon Sep 17 00:00:00 2001 From: pyth0n1c <87383215+pyth0n1c@users.noreply.github.com> Date: Thu, 13 Jan 2022 10:25:07 -0800 Subject: [PATCH 2/4] Added spaces to fix format of github.event.action --- .github/workflows/detection-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/detection-testing.yml b/.github/workflows/detection-testing.yml index 3e08506122..fcb16db570 100644 --- a/.github/workflows/detection-testing.yml +++ b/.github/workflows/detection-testing.yml @@ -74,10 +74,10 @@ jobs: echo "github.event.pull_request.number : [${{ github.event.pull_request.number }}]" echo "steps.vars.outputs.branch : [${{ steps.vars.outputs.branch }}]" echo "github.event.pull_request.head.ref : [${{ github.event.pull_request.head.ref }}]" - echo "The trigger (github.event.action) : [${{github.event.action}}]" + echo "github.event.action : [${{ github.event.action }}]" - if [[ ${{github.event.action}} == schedule ]]; then + if [[ ${{ github.event.action }} == schedule ]]; then # Note that scheduled actions ONLY run on the default branch, so it won't run on all other branches! echo "Running a nightly test on all detections OR a commit was made directly to develop" python detection_testing_execution.py run --branch develop --mode all --mock --config_file test_config_github_actions.json From 928797252dfc9b53f0d63a2041aa986632c08592 Mon Sep 17 00:00:00 2001 From: pyth0n1c <87383215+pyth0n1c@users.noreply.github.com> Date: Thu, 13 Jan 2022 10:32:49 -0800 Subject: [PATCH 3/4] Changed from github.event.action to github.event_name --- .github/workflows/detection-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/detection-testing.yml b/.github/workflows/detection-testing.yml index fcb16db570..14ec8e3036 100644 --- a/.github/workflows/detection-testing.yml +++ b/.github/workflows/detection-testing.yml @@ -74,10 +74,10 @@ jobs: echo "github.event.pull_request.number : [${{ github.event.pull_request.number }}]" echo "steps.vars.outputs.branch : [${{ steps.vars.outputs.branch }}]" echo "github.event.pull_request.head.ref : [${{ github.event.pull_request.head.ref }}]" - echo "github.event.action : [${{ github.event.action }}]" + echo "github.event_name : [${{ github.event_name }}]" - if [[ ${{ github.event.action }} == schedule ]]; then + if [[ ${{ github.event_name }} == schedule ]]; then # Note that scheduled actions ONLY run on the default branch, so it won't run on all other branches! echo "Running a nightly test on all detections OR a commit was made directly to develop" python detection_testing_execution.py run --branch develop --mode all --mock --config_file test_config_github_actions.json From cc90aca4b9574b947567a6e48b834b03f3fb8ae5 Mon Sep 17 00:00:00 2001 From: pyth0n1c <87383215+pyth0n1c@users.noreply.github.com> Date: Thu, 13 Jan 2022 10:35:23 -0800 Subject: [PATCH 4/4] Fixed spacing in printouts for detection-testing.yml --- .github/workflows/detection-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/detection-testing.yml b/.github/workflows/detection-testing.yml index 14ec8e3036..5792cb38ad 100644 --- a/.github/workflows/detection-testing.yml +++ b/.github/workflows/detection-testing.yml @@ -74,7 +74,7 @@ jobs: echo "github.event.pull_request.number : [${{ github.event.pull_request.number }}]" echo "steps.vars.outputs.branch : [${{ steps.vars.outputs.branch }}]" echo "github.event.pull_request.head.ref : [${{ github.event.pull_request.head.ref }}]" - echo "github.event_name : [${{ github.event_name }}]" + echo "github.event_name : [${{ github.event_name }}]" if [[ ${{ github.event_name }} == schedule ]]; then