From 52e33a7a53e99b425dedf0f7bfd0f949d80b303f Mon Sep 17 00:00:00 2001 From: Benjamin Rasmussen Date: Sun, 20 Nov 2022 20:24:18 +0100 Subject: [PATCH] V2 tweaks. --- .github/workflows/drupal-regression.yml | 4 ++-- README.md | 2 +- action.yml | 8 ++++++-- compare.py | 9 +++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/drupal-regression.yml b/.github/workflows/drupal-regression.yml index 6c5ff5e..644225f 100644 --- a/.github/workflows/drupal-regression.yml +++ b/.github/workflows/drupal-regression.yml @@ -34,14 +34,14 @@ jobs: edit-mode: replace reactions: ${{ steps.drupal-regression.outputs.reactions }} - uses: actions/checkout@v1 - - uses: reload/action-platformsh-url@main + - uses: reload/action-platformsh-url@v2 id: platformsh_url with: PLATFORMSH_ID: ${{ inputs.PLATFORMSH_ID }} PLATFORMSH_KEY: ${{ secrets.PLATFORMSH_KEY }} - name: Drupal Regression id: drupal-regression - uses: reload/action-drupal-regression@main + uses: reload/action-drupal-regression@v2 with: url: ${{ steps.platformsh_url.outputs.url }} work_dir: ${{ inputs.WORK_DIR }} diff --git a/README.md b/README.md index 228b035..8718e69 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Example setup: https://github.com/reload/storypal/blob/main/.github/workflows/dr - Have python3 + pip3 installed - `pip3 install install wheel colorama requests validators pytidylib` -- `python3 compare.py --url=https://some-remote-api-url.com --workdir=drupal-regression` +- `python3 compare.py --url=https://some-remote-api-url.com` If you want to test with the exact, markdown output that GitHub Action uses: diff --git a/action.yml b/action.yml index 7e9e11b..21dc71c 100644 --- a/action.yml +++ b/action.yml @@ -1,7 +1,9 @@ name: 'Drupal Regression' description: 'Using Drupal regression API.' -icon: droplet -color: blue +branding: + icon: 'droplet' + color: 'blue' + inputs: url: description: 'Test URL, to check existing data against' @@ -9,9 +11,11 @@ inputs: work_dir: description: 'The work dir to save regressions in. - defaults to drupal-regression' default: 'drupal-regression' + outputs: diff: description: 'The difference, if any' + runs: using: 'docker' image: 'Dockerfile' diff --git a/compare.py b/compare.py index ab800ed..d52f1ed 100644 --- a/compare.py +++ b/compare.py @@ -274,11 +274,16 @@ class txtmod: failed = False - if api_data['messages']['errors'] or html_errors: + error_messages = {} + + if 'errors' in api_data['messages']: + error_messages = api_data['messages']['errors'] + + if error_messages or html_errors: return_message += txtmod.BOLD + txtmod.UNDERLINE + "Encountered errors:" + txtmod.ENDBOLD + txtmod.ENDUNDERLINE + txtmod.NEWLINE + txtmod.NEWLINE failed = True - for error in api_data['messages']['errors']: + for error in error_messages: return_message += " - " + txtmod.FAIL + error + txtmod.ENDC + txtmod.NEWLINE if html_errors: