Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Commit

Permalink
Add the app name to outputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieutu authored and suryasr007 committed Mar 28, 2020
1 parent 3d8fa38 commit dd9efcc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ A Github Action that tests the deployment status of a Heroku Review App.
# `steps.review_app_test.outputs.review_app_url` must be used in workflow to fetch the Review App URL
- name: Check review_app_url
run: |
echo "Outputs - ${{ steps.review_app_test.outputs.review_app_url }}"
echo "Outputs :"
echo "- App name: ${{ steps.review_app_test.outputs.review_app_name }}"
echo "- App url: ${{ steps.review_app_test.outputs.review_app_url }}"
```
> Note: Work flow should include `pull_request` event.
Expand Down
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ inputs:
default: 120

outputs:
review_app_name:
description: "The name of the Heroku review app deployed."
review_app_url:
description: "Review App URL from the action."
description: "The URL of the Heroku review app deployed."
5 changes: 4 additions & 1 deletion review_app_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,18 @@ def main() -> None:
logger.info(f"Load time delay: {args.load_time_delay} seconds")
time.sleep(args.load_time_delay)

review_app_name = reviewapp_build_data['environment']
review_app_url = f"https://{review_app_name}.herokuapp.com"

# Check the HTTP response from app URL
review_app_url = f"https://{reviewapp_build_data['environment']}.herokuapp.com"
_check_review_app_deployment_status(
review_app_url=review_app_url,
accepted_responses=args.accepted_responses,
timeout=args.publish_timeout,
interval=args.interval,
)

print(f"::set-output name=review_app_name::{review_app_name}")
print(f"::set-output name=review_app_url::{review_app_url}")
print("Successful")

Expand Down
1 change: 1 addition & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def test_main_success(
out, err = capsys.readouterr()

"set-output name=review_app_url::https://foo-pr-bar.herokuapp.com" in out
"set-output name=review_app_name::foo-pr-bar" in out
"Successful" in out


Expand Down

0 comments on commit dd9efcc

Please sign in to comment.