Skip to content

Commit

Permalink
V2 tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
rasben committed Nov 20, 2022
1 parent 0f27778 commit 52e33a7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/drupal-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
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'
required: true
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'
Expand Down
9 changes: 7 additions & 2 deletions compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 52e33a7

Please sign in to comment.