From 35d356f02bee1d057b94718e9bae693603b3b9cc Mon Sep 17 00:00:00 2001 From: Tung Beier <44575474+beiertu-mms@users.noreply.github.com> Date: Tue, 14 Mar 2023 16:10:12 +0100 Subject: [PATCH] fix(test): adapt test validation (#18) * fix(test): adapt test validation Related to the change in https://github.com/karancode/yamllint-github-action/pull/17 * feat(action): run CI on pull request against master --- .github/workflows/test.yml | 3 +++ tests/run.bats | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d5cc20f..e79c484 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,9 @@ on: - 'dependabot/*' schedule: - cron: '22 22 * * 5' + pull_request: + branches: + - 'master' jobs: test: diff --git a/tests/run.bats b/tests/run.bats index f6126a8..f42acca 100755 --- a/tests/run.bats +++ b/tests/run.bats @@ -2,7 +2,7 @@ # NOTE: environment variable GITHUB_EVENT_PATH # is required in a pullrequest scenario. If the variable -# is not set the test the test is gonna hang. +# is not set the test is gonna hang. # global variables ############################################################ CONTAINER_NAME="yamllint-github-action" @@ -73,7 +73,7 @@ function setup() { echo $output | grep -q "lint: error: failed yamllint on" echo $output | grep -q "line too long (114 > 80 characters)" - cat ${GITHUB_OUTPUT_FILE} | grep -q "yamllint_output=${INPUT_YAMLLINT_FILE_OR_DIR}" + cat ${GITHUB_OUTPUT_FILE} | grep -q -Pzo "yamllint_output< 80 characters)" echo $output | grep -q "lint: info: commenting on the pull request" - cat ${GITHUB_OUTPUT_FILE} | grep -q "yamllint_output=${INPUT_YAMLLINT_FILE_OR_DIR}" + cat ${GITHUB_OUTPUT_FILE} | grep -q -Pzo "yamllint_output< 80 characters)" echo $output | grep -q "lint: info: commenting on the pull request" - cat ${GITHUB_OUTPUT_FILE} | grep -q "yamllint_output=${INPUT_YAMLLINT_FILE_OR_DIR}" + cat ${GITHUB_OUTPUT_FILE} | grep -q -Pzo "yamllint_output< 80 characters)" echo $output | grep -vq "lint: info: commenting on the pull request" - cat ${GITHUB_OUTPUT_FILE} | grep -q "yamllint_output=${INPUT_YAMLLINT_FILE_OR_DIR}" + cat ${GITHUB_OUTPUT_FILE} | grep -q -Pzo "yamllint_output< 80 characters)" echo $output | grep -vq "lint: info: commenting on the pull request" - cat ${GITHUB_OUTPUT_FILE} | grep -q "yamllint_output=${INPUT_YAMLLINT_FILE_OR_DIR}" + cat ${GITHUB_OUTPUT_FILE} | grep -q -Pzo "yamllint_output< 80 characters)" echo $output | grep -vq "lint: info: commenting on the pull request" - cat ${GITHUB_OUTPUT_FILE} | grep -q "yamllint_output=${INPUT_YAMLLINT_FILE_OR_DIR}" + cat ${GITHUB_OUTPUT_FILE} | grep -q -Pzo "yamllint_output< 80 characters)" echo $output | grep -vq "lint: info: commenting on the pull request" - cat ${GITHUB_OUTPUT_FILE} | grep -q "yamllint_output=${INPUT_YAMLLINT_FILE_OR_DIR}" + cat ${GITHUB_OUTPUT_FILE} | grep -q -Pzo "yamllint_output<