-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | | ||
|
@@ -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 }} | ||
|
@@ -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() | ||
|