Skip to content

Commit

Permalink
Merge pull request #8 from newrelic/jthurman/errormsg
Browse files Browse the repository at this point in the history
[Fix] Update error handling for Actions
  • Loading branch information
Jonathan Thurman authored May 21, 2020
2 parents dfd32bc + 46e7333 commit 3c31b58
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 24 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/main.yaml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
basic_test:
runs-on: ubuntu-latest
name: Release marker example
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set Release Version from Tag
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF:10}

- name: Test deployment marker
uses: ./
with:
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.APPLICATION_ID }}
revision: "deployment-marker-action-release:${{ env.RELEASE_VERSION }}"

54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test Suite

on:
pull_request:
push:
branches:
- master

jobs:
# should_fail_test:
# runs-on: ubuntu-latest
# name: Should Fail Test
# steps:
# - name: Checkout
# uses: actions/checkout@v2
#
# - name: Test deployment marker
# uses: ./
# with:
# apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
# applicationId: 0
# revision: "deployment-marker-action-should-fail-test:${{ github.ref }}"

basic_test:
runs-on: ubuntu-latest
name: Basic Usage Test
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Test deployment marker
uses: ./
with:
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.APPLICATION_ID }}
revision: "deployment-marker-action-basic-test:${{ github.ref }}"

all_inputs_test:
runs-on: ubuntu-latest
name: All Inputs Test
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Test deployment marker
uses: ./
with:
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.APPLICATION_ID }}
revision: "deployment-marker-action-all-input-test-${{ github.sha }}"
user: "hardcoded-test-username" # optional
region: US # optional
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }} # optional

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Community Project header](https://github.com/newrelic/open-source-office/raw/master/examples/categories/images/Community_Project.png)](https://github.com/newrelic/open-source-office/blob/master/examples/categories/index.md#category-community-project)

# New Relic Application Deployment Marker
New Relic App Deployment Marker

[![GitHub Marketplace version](https://img.shields.io/github/release/newrelic/deployment-marker-action.svg?label=Marketplace&logo=github)](https://github.com/marketplace/actions/new-relic-application-deployment-marker)

Expand Down
5 changes: 1 addition & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/bin/sh

RED='\033[0;31m'
NO_COLOR='\033[0m'

result=$(newrelic apm deployment create --applicationId "${APPLICATION_ID}" --revision "${REVISION}" --accountId "${NEW_RELIC_ACCOUNT_ID}" --user "${NEW_RELIC_DEPLOYMENT_USER}" 2>&1)

exitStatus=$?

if [ $exitStatus -ne 0 ]; then
printf "${RED}Error:${NO_COLOR} $result"
echo "::error:: $result"
fi

exit $exitStatus

0 comments on commit 3c31b58

Please sign in to comment.