Skip to content

Commit

Permalink
UHF-8762: Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tuutti committed Jan 30, 2024
1 parent 1a89f4f commit 9978ff0
Showing 1 changed file with 19 additions and 29 deletions.
48 changes: 19 additions & 29 deletions .github/workflows/visual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ jobs:
- name: Parse $THEME_NAME from composer.json
run: echo "THEME_NAME=$(cat composer.json | jq -r .name | awk -F/ '{print $NF}')" >> $GITHUB_ENV

- name: Set theme folder
run: echo "THEME_FOLDER=$DRUPAL_ROOT/public/themes/contrib/$THEME_NAME" >> $GITHUB_ENV
- name: Set variables
run: |
echo "THEME_FOLDER=$DRUPAL_ROOT/public/themes/contrib/$THEME_NAME" >> $GITHUB_ENV
echo "REPORT_URL=https://city-of-helsinki.github.io/drupal-hdbt/pull/${{ github.event.pull_request.number }}/html_report/" >> $GITHUB_ENV
- name: Clone platform
run: |
Expand Down Expand Up @@ -113,34 +115,11 @@ jobs:
id: run-tests
if: github.ref != 'refs/heads/main'
run: |
COMMENT="Tests passed!"
if ! npm run full-test; then
echo "result=Tests failed!" >> $GITHUB_OUTPUT
else
echo "result=Tests passed!" >> $GITHUB_OUTPUT
fi
echo "output_url=You can check the output here: https://city-of-helsinki.github.io/drupal-hdbt/pull/${{ github.event.pull_request.number }}/html_report/" >> $GITHUB_OUTPUT
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'

- name: Create comment
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{join(steps.run-tests.outputs.*, "\n")}}

- name: Update comment
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: ${{join(steps.run-tests.outputs.*, "\n")}}
edit-mode: replace
COMMENT="Tests failed!"
COMMENT+="\nYou can check the output here: https://city-of-helsinki.github.io/drupal-hdbt/pull/${{ github.event.pull_request.number }}/html_report/"
echo "comment=$COMMENT" >> $GITHUB_OUTPUT
- name: Export container logs
working-directory: ${{ env.DRUPAL_ROOT }}
Expand All @@ -154,6 +133,17 @@ jobs:
publish_dir: ${{ env.THEME_FOLDER }}/backstop_data/full/
destination_dir: pull/${{github.event.number}}

- name: Update comment
uses: hasura/[email protected]
if: github.ref != 'refs/heads/main'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
recreate: true
message: "${{ steps.run-tests.outputs.comment }}"

- name: Upload container logs
uses: actions/upload-artifact@v4
if: always()
Expand Down

0 comments on commit 9978ff0

Please sign in to comment.